15 Replies - 638 Views - Last Post: 01 June 2012 - 09:29 AM
#1
How to know if TextArea (awt) is being typed?
Posted 30 May 2012 - 02:59 PM
i'm using awt to create textarea, it's textarea, not JTextArea (swing).
thanks for help
Replies To: How to know if TextArea (awt) is being typed?
#2
Re: How to know if TextArea (awt) is being typed?
Posted 30 May 2012 - 03:54 PM
Quote
Why, as a matter of interest?
#3
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 02:39 AM
g00se, on 30 May 2012 - 10:54 PM, said:
Why, as a matter of interest?
and how to do that, i have searched in google and i can not find , most of i found were JTextArea (Swing) not TextArea (Awt)
i have a piece of code below, i want to create a text editor with a title. If user click on textarea and typing something, the title will be added a symbol "*" before default title, so the title will be look like this " *untitled "
how to add keylistener??
thanks
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
public class MyTextarea extends JFrame implements ActionListener{
private TextArea textarea = new TextArea("",0,0,TextArea.SCROLLBARS_VERTICAL_ONLY);
public MyTextarea(){
//contructor
setSize(500, 400);
setTitle("Free TextEditor v.0.1");
setDefaultCloseOperation(EXIT_ON_CLOSE);//kalo pakai JFrame
add(textarea);
}
@Override
public void actionPerformed(ActionEvent e) {
//
}
public static void main(String args[]){
MyTextarea notepad = new MyTextarea();
notepad.setVisible(true);
}
}
#4
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 02:47 AM
This post has been edited by g00se: 31 May 2012 - 02:48 AM
Reason for edit:: punctuation
#5
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 02:51 AM
what do you thing?
why we should not mix awt and swing???
#6
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 02:58 AM
Quote
It used to be because the way awt components related to their windowing peers in the OS conflicted with the way Swing components did so. That's not nearly so much of a problem now, but mixing them still muddies the design. One or the other should be used. The question is, why would you want to mix them anyway?
#7
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 03:17 AM
Quote
i don't know if mixing them will make some problem like that,
i'm interesting tutorial about how to create a java notepad write by gabehabe here http://www.dreaminco...on/page__st__30
he mixed awt and swing,,,
#8
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 03:22 AM
Quote
He did. My comments still apply. And if you run that code on an old enough vm, it's quite possible you'll get windowing problems
This post has been edited by g00se: 31 May 2012 - 03:23 AM
#9
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 03:44 AM
Quote
and what about the current VM version?? any problem exist with this version??
hi, and how to add keylistener? i have searched, i have read documentation, but i can not figure out,
#10
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 03:55 AM
Quote
Probably unlikely to get problems. Why not just use a tutorial that doesn't mix AWT and Swing?
http://docs.oracle.c...eylistener.html
#11
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 04:14 AM
Quote
i don't know but, i think mixing awt and swing is a unique, so, i'm trying this.
and also, i have not found a tutorial how to create a notepad using SWING only.
Oracle docs, i will try read it,
#12
Re: How to know if TextArea (awt) is being typed?
Posted 31 May 2012 - 02:19 PM
Quote
So put a JTextArea in it I doubt there are much differences if any...
Kind of useless in 2012 to learn how a TextArea works
#13
Re: How to know if TextArea (awt) is being typed?
Posted 01 June 2012 - 03:48 AM
Quote
and what does it mean??
will TextArea be deprecated??
Hi, btw i have done with keylistener (
#14
Re: How to know if TextArea (awt) is being typed?
Posted 01 June 2012 - 05:15 AM
Quote
It means that using AWT gui components is the old way of doing things. Unless you have a very good reason, you should use Swing
#15
Re: How to know if TextArea (awt) is being typed?
Posted 01 June 2012 - 09:06 AM
|
|

New Topic/Question
Reply



MultiQuote




|