Questions tagged [awt]

The Abstract Window Toolkit (AWT) is Java's original platform-independent windowing, graphics, and user-interface widget toolkit.

The AWT is now part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program.

AWT is also the GUI toolkit for a number of Java ME profiles. For example, Connected Device Configuration profiles require Java runtimes on mobile telephones to support AWT.

http://en.wikipedia.org/wiki/Abstract_Window_Toolkit

6277 questions
233
votes
9 answers

What is the difference between Swing and AWT?

Can someone please explain me what's the difference between Swing and AWT? Are there any cases where AWT is more useful/advised to use than swing or vice-versa?
Samiksha
  • 5,852
  • 6
  • 26
  • 28
228
votes
9 answers

Java GUI frameworks. What to choose? Swing, SWT, AWT, SwingX, JGoodies, JavaFX, Apache Pivot?

There is quite a lot of gui frameworks out there for java, but what is recognized as today's framework of choice? The following is my understanding of the different frameworks, please correct me if im wrong. This is a very loosely defined set of…
netbrain
  • 8,694
  • 6
  • 37
  • 66
119
votes
17 answers

How to center a Window in Java?

What's the easiest way to centre a java.awt.Window, such as a JFrame or a JDialog?
Andrew Swan
  • 12,737
  • 19
  • 64
  • 97
90
votes
11 answers

How to bring a window to the front?

We have a Java application that needs to be brought to the foreground when a telecontrol mechanism activates something in the application. In order to get this, we have realized in the called method of the class which represents the frame of our…
boutta
  • 22,571
  • 7
  • 33
  • 45
87
votes
3 answers

"Always on Top" Windows with Java

In Java, is there a way to have a window that is "Always on top" regardless if the user switches focus to another application? I've searched the web, and all of the solutions lean to some sort of JNI interface with native bindings. Truly this…
Laplie Anderson
  • 6,039
  • 3
  • 31
  • 37
83
votes
5 answers

Java GUI listeners without AWT

I am a starting Java developer, learning just from internet tutorials. I am learning full screen GUI applications. I was told yesterday that I shouldn't use AWT in my programs, because it is outdated. I already know about light and heavyweight…
Hidde
  • 9,683
  • 7
  • 38
  • 64
78
votes
5 answers

Copying to the clipboard in Java

I want to set the user's clipboard to a string in a Java console application. Any ideas?
clone1018
  • 1,117
  • 1
  • 9
  • 11
63
votes
3 answers

Loading resources like images while running project distributed as JAR archive

I am having a error for my GUI. Trying to set title bar icon then be included in a Runnable JAR. BufferedImage image = null; try { image = ImageIO.read(getClass().getClassLoader().getResource("resources/icon.gif")); } catch (IOException e) { …
exlux15
  • 861
  • 1
  • 8
  • 16
62
votes
2 answers

Java Event-Dispatching Thread explanation

I've recently started learning and exploring the basics of GUI programming in Java. Having been programming for a while I have only done backend work or work and as a result the closest I've gotten to user interfaces is the command console…
linuscash
  • 1,035
  • 1
  • 8
  • 17
57
votes
15 answers

Setting background color for a JFrame

Just how do you set the background color for a JFrame?
Raji
56
votes
5 answers

SwingUtilities.invokeLater

My question is related to SwingUtilities.invokeLater. When should I use it? Do I have to use each time I need to update the GUI components? What does it exactly do? Is there an alternative to it since it doesn't sound intuitive and adds seemingly…
FadelMS
  • 1,987
  • 4
  • 23
  • 41
56
votes
9 answers

Java: using an image as a button

I would like to use an image as a button in Java, and I tried to do this: BufferedImage buttonIcon = ImageIO.read(new File("buttonIconPath")); button = new JButton(new ImageIcon(buttonIcon)); But this still shows the actual button behind the image,…
3sdmx
  • 748
  • 2
  • 6
  • 10
47
votes
5 answers

What does SwingUtilities.invokeLater do?

What does SwingUtilities.invokeLater do? Is it just delaying the execution of a block of codes inside its run method? What is the difference between calling an action within the invokeLater function or simply calling it at the end of the thread we…
user633784
44
votes
4 answers

Is storing Graphics objects a good idea?

I'm currently in the process of writing a paint program in java, designed to have flexible and comprehensive functionalities. It stemmed from my final project, that I wrote overnight the day before. Because of that, it's got tons and tons of bugs,…
Zizouz212
  • 4,578
  • 5
  • 36
  • 62
40
votes
2 answers

Calling awt Frame methods from subclass

This question is about Frames, Java and Processing. This questions sounds pretty convoluted but its really not. I'll try keep this to a simple minimum. I'm creating a small ball in a maze game to get my head around physics and rendering. It's been a…
OVERTONE
  • 10,737
  • 20
  • 62
  • 86
1
2 3
99 100