AWT Section Index | Page 5
Changing style of selected text in Text Area componet of awt
Changing style of selected text in Text Area componet of awt
I am trying to change the text style like Bold, Italic or changing font of selected text in Text Area componet of java awt package. But...more
Can I change thickness of a line in Graphics without using Graphics2D?
You can achieve this by drawing a rectangle (the width being the thickness and the height being the line length).
[FAQ Manager Note] Note that this will only work for vertical and horizontal line...more
Can I make an AWT Panel transparent?
You can create a subclass of Container:
public class TransparentPanel
extends Container {
public TransparentPanel() {}
public TransparentPanel(LayoutManager m) {
super(m);
}
}
...more
How do you drag and drop one row in a JTable to another… How do you drag and drop one row in a JTable to another location in the JTable.
We can do this by creating a library of drag and drop-enabled Swing components.
Issues for drag and drop components
Starting the drag operation
Drag-under feedback
Drag-over feedback
The drop
Tr...more
What are the advantages and disadvantages of Java Advanced Imaging over dealing Images with AWT?
Early versions of the Java AWT provided a simple rendering package suitable for rendering common HTML pages, but without the features necessary for complex imaging. The early AWT allowed the gener...more
How do you drag a multiple selection in a JTree (like… How do you drag a multiple selection in a JTree (like in Windows Explorer)?
There is only one answer : You can't. The current Java DnD implementation doesn't support dragging/dropping of multiple transferables. I hope that JDK1.4, codename Merlin, may support DnD with mul...more
Will Sun continue updating and supporting AWT, or is… Will Sun continue updating and supporting AWT, or is it going to phase it out and support only Swing?
Because swing is based on awt, sun has to keep it. I think sun will not introduce any new features in awt. On the other hand sun will make bugfixes because these also affect the swing components.
more
Why do we need to import java.awt.event.* if you have already imported java.awt.*?
Because Java doesn't support the concept of "nested packages".
While there seems to be a relationship between
java.awt
and
java.awt.event
there is actually no relationship betwe...more
How can I make a TextArea Word-Wrap?
Simply disable the horizontal scrollbar, and the text will wrap.
In other words, use only vertical scrollbars
TextArea ta = new TextArea("", 10, 30, TextArea.SCROLLBARS_VERTICAL_ONL...more
How do I justify text in a TextArea?
You can't. Look into javax.swing.JTextPane.
I need to learn more about printing in JDK 1.1; I cannot use Java 2 and its Java 2D printing support. Can you suggest any references?
I need to learn more about printing in JDK 1.1; I cannot
use Java 2 and its Java 2D printing support. Can you suggest
any references?more
How can I capture and modify the value of the key pressed before it will be displayed in the TextArea ?
override processKeyEvent()
recreate another KeyEvent with all parameters
same as the original KeyEvent except for the
value.
call consume() on the original KeyEvent.
now call super.processKey...more
How can I place an image on an AWT button?
Subclass Button and override the paint method.
public void paint(Graphics g) {
// call super's paint method
super.paint(g);
g.drawImage(...); // use any of the many drawImage variants her...more
Is there any way to make a Canvas be double buffered?
Yes. Same as any other component i.e. creating an offscreen image of same size.
painting on that image's graphics and then copying it to the graphics of the Component.
[NOTE:
Mind the size of the ...more
What is going on behind the scenes when I add a Component (like a button) to a Container (like a Frame)?
First, if the component is already inside another component, it is removed from that component.
Next, a pointer to the component is added to the container's "components" list. This keep...more