awt

how do i close a frame yet open a new frame?(revisited)

I'm new at Java and I'm trying to do what the title says, my application has page A, a jpanel with some controls and a specific button, and when the user clicks the button i want page A to disappear and page B to appear (page B has controls that depend on the choices that are made by the user on page A). This has been asked before but t...

Paint a graph in Java using AWT

Hi, I'm searching a possibility to paint a graph in Java using AWT. My knowledge of Java is still basic, so this is mainly for getting used to AWT, even if it's already "old". -Felix ...

Laying out JPanels to make a simple GUI

Hello, first of all, this is more or less my first GUI and ive learned Java for not more then a week, so it might contain some serious programming errors. What i have right now is: Buttons and labels are part of OptionPanel and are on the left, DrawingPanel is about 5x5 px in size and is on the right. What I am trying to do is a simpl...

Running a swing application programmatically (remote classes)

Dear Friends, I have a slightly complicated case where I do not have source code (or the compiled class) the swing application that I am trying to run automatically. I will try to do a series of tasks on this application, press some buttons, click on some parts etc. I want to be able to do this programatically. Every single swing de...

Is Java Swing still in use?

I am planning on making a Java Swing application and was wondering if Swing is still used or if it has been replaced with something else. Thanks in advance! ...

visualizing enter symbol in java applet (fonts or graphics?)

How can I display the graphical "enter symbol" within java applet ? I want to show exactly "↵", which is U+21B5 DOWNWARDS ARROW WITH CORNER LEFTWARDS. – I want to draw this to applet's screen so that it works in WIN, LINUX, MACOSX, etc. Is there a font available that makes this possible or should I draw it somehow, how ? g2d.setFont...

Creating a custom device for Swing/AWT to draw to

I am working on an embedded linux device that requires custom java code to draw to the screen. I was wondering if there was any way to create a custom adapter that can update the display based off our drawing code. I have done some digging and haven't found any information as to how Devices are implemented or plugged into Swing/AWT. Any ...

Determine modifier key state without an InputEvent object in Java

I need to determine the current state of the Shift key, but at the time I need the state I don't have an InputEvent object around. I need something like java.awt.Toolkit.getLockingKeyState(int) that works for Shift, not just the locking keys like VK_CAPS_LOCK. Is there a way I can do this without listening to input events and storing t...

setSize not influencing size of button

I have a sample code : import java.awt.*; import javax.swing.*; import javax.swing.border.BevelBorder; public class AWT extends JFrame { public static void main(String[] args) { final JFrame frame = new JFrame(); frame.setPreferredSize(new Dimension(600, 450)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_...

How to use TYPE_BYTE_GRAY to efficiently create a grayscale bufferedimage using AWT

I need to create a grayscale image from data in an nio ShortBuffer. I have a function that maps the data in the ShortBuffer to unsigned byte but is in an int (easily changed). The method I found uses an RGB plus transparency color model and appears to be quite inefficent. i have not been able to see how to apply the TYPE_BYTE_GRAY and...

How to close a JFrame based window with a JButton click event

I am new to the whole Java Swing/AWT dialogs (which explains how amateurish this dialog below looks like, any help in arranging it better is welcome :) and I am struggling to close this popUp window when any of the two JButtons are clicked. I have already tried options like frame.dispose(), frame.setVisible(false) and even SwingUtilitie...

Simple JFrame dialog displaying JButton

First off, I am real new to Java Swing/AWT and not intricately familiar with the workings of JFrame, JPanel & JButton. I want to just display a simple PopUp dialog with a some text and a couple JButtons and it should exit when any of the two buttons are clicked. I have most of that logic in this class, however I'm still struggling to mak...

Why is my simple JFrame displaying weird?

I am a newbie at Java Swing/AWT and I have this code following working for a simple PopUp dialog which closes on any of the JButtons beind clicked, but displays real wonky. Does anybody have suggestions on what and how to fix? import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java....

AWT text measuring implementations

The Java 6 (J2SE) implementation of AttributedString, TextLayout, and LineBreakMeasurer classes use anti-aliasing properties and fractional math for metrics calculations. This causes a severe performance penalty. What suggestions (for Cent OS Linux) do you have to increase performance? Such as: A faster JVM (JDK 1.7, Oracle's JRockit,...

Java external display connected callback?

Hi, I'm writing a presentation app which is supposed to present on the 2nd display in extended mode. For that I want to have a "Start presentation" button which reflects the actual state of external display connections: it should be gray and non-clickable if no external displays are connected. And it should be enabled if there is at le...

What Can Cause a NullPointerException in java.awt.Graphics.setClip Under Microsoft VM?

There's a ten-year-old Java applet I've recently been asked to fix some bugs in, and one of those only occurs when running under Microsoft's old JVM rather than Sun's. (Or, at least, it doesn't occur under any recent Sun JRE - I haven't dug out Sun Java 1.1 to try and check.) Yes, I'm aware that Microsoft's JVM is end-of-life, and I've...

Genome browser built in java: Swing and awt or Swing and Processing?

I'm writing a genome browser designed primarily to view the history of chromosomal rearrangements. Right now the project is a series of proof-of-concept demos written using Processing. At this point if I don't make any radical changes the final application will be a web applet with a gui built of swing components that open PApplets to ac...

How to display info using Java AWT?

Hi, I've developed an application using servlets, MySQL and Tomcat. I've been asked to create a version of this application that does not require the use of a server. I've researching and I think that what I need is to create windows where I can show information to the user and to retrieve information from the users. I've learned how...

Why do the JButton in my dialog look weird

I'm fairly new to Java Swing/AWT et al and hence the question. I have a simple dialog with some text and a couple JButton. I am using the GridbagLayout for this dialog. But when I look at the dialog, the JButtons are kind of having a weird shape and I cannot seem to right justify the text either. Is this a limitation of the Layout I ...

Java cannot find symbol in List

OK so I switched from JList to List because 1.) It doesn't overlap my drawn images 2.) It can have focus disabled yet track what's selected Anyway, here's the error I get when I try to compile: C:\Users\Dan\Documents\DanJavaGen\inventory.java:30: cannot find symbol symbol : constructor List(java.lang.Object[]) location: class java.aw...