awt

Java Applet - List error

OK so I'm doing an ArrayList into a (awt) List and I'm getting the following errors when compiling. C:\Users\Dan\Documents\DanJavaGen\ArrayList_INV.java:29: cannot find symbol symbol : constructor List(java.lang.Object[]) location: class java.awt.List list = new java.awt.List(arr.toArray()); ^ C:\Users\Dan\Docume...

Java List set Background of list item

Simple question: How to change a background color of a Java AWT List? By that I mean the list ITEM *not* the WHOLE list. SO > Google :) ...

Java/AWT/Swing: how to distinguish the pressed enter or return key

It looks like native applications behave differently if the user presses the Return key (right to the characters) or the Enter key (number key pad) - one time a new line character is inserted, the other time the default button is activated. How I can distinguish both key presses from Java/AWT/Swing? ...

Java2D & Image creation

I want to dynamically create some image from Java and save it to a file. As I read in various tutorials, I need to use BufferedImage. But, the BufferedImage constructor requires that the height and width as parameters. But I don't know the final size of my image. How should I create an image with size unknown in advance? There are two ...

Make a BufferedImage use less RAM?

I have java program that reads a jpegfile from the harddrive and uses it as the background image for various other things. The image itself is stored in a BufferImage object like so: BufferedImage background background = ImageIO.read(file) This works great - the problem is that the BufferedImage object itself is enormous. For exampl...

Add & remove JTextField at runtime in Java(Swings) program

how to add and remove components(JButons , JTextField etc) at runtime in a Swing program (Java ) , without using NetBeans ? which Layout should I use ? I want the user to enter Username & Password and , when he clicks on Submit button , the new screen with new components(JButtons , JTextField etc) should appear , I am unable to achieve ...

Workflow UI in Java

Does anyone know of a Java (Swing) based UI framework for building a Workflow application? -Users are given a set of activities -They can drag and drop these activities -Link activities to each other (workflow steps) ...

How can I customize the render of JRadioButton?

I've created a JRadioButton subclass in which I override the paintComponent method like so: @Override protected void paintComponent(Graphics g) { g.drawImage( isSelected() ? getCheckedImg() : getBasicImg() , 0, 0, this); } but it seems that once the button is drawn, that's the image it uses forev...

How to avoid HeadlessException in thread?

I have tried to open a dialog box in Servlet & it opens fine. But then I tried to achieve same thing in my thread's run method. It gaved me following error: java.awt.HeadlessException at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159) at java.awt.Window.<init>(Window.java:431) at java.awt.Frame.<init>(Frame.java...

Getting Height and Width of Image in Java without an ImageObserver.

Hi everyone, I am trying to get the heigh and width of images (via a url) in Java without an ImageObserver. My current code is: public static void main(String[] args) throws IOException { // TODO Auto-generated method stub File xmlImages = new File("C:\\images.xml"); BufferedReader br = new BufferedReader(new F...

Java - Filling a Custom Shape

I have created a custom shape, essentially it is a collection of four Arc2D objects. When these arcs are drawn they form what could be considered a four point rounded star shape, kind of like a clover. Where one arc ends, the other begins. They form a square in the center. So imagine, taking a square and drawing half circles on every...

Java/AWT: detect bitmap fonts

I have some fonts, e.g. dymsmall, installed on my Windows machine which cause the VM to crash when graphics.getFontMetrics(font).stringWidth("hello world") is invoked (the font instances are returned by GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()). It looks like those fonts which crash the VM are bitmap fonts. Do you ...

What GUI toolkit is Cisco's ASDM written in?

I like the way ASDM on a ASA5505 works very much. Would anyone know what GUI toolkit did Cisco use to develop it? ...

Should I be concerned using AWTUtilities.setWindowShape()?

I am using the AWTUtilities class in my application to create custom window shapes. As far as I know, there is no other way to do it. It is a requirement. The javadoc generation gives me this error: warning: com.sun.awt.AWTUtilities is Sun proprietary API and may be removed in a future release What exactly does this mean? I can use ...

"Buffers have not been created" ... whilst creating buffers.

I have (what I thought was) a straightforward BufferStrategy for a JFrame. It is created like so: // Buffer container.createBufferStrategy(2); strategy = container.getBufferStrategy(); However, occassionally I receive the following error (which points to the first line of the preceeding snippet as the offending ...

AWT repaint issues

I am trying to make some small additions to some old java code that does not support swing. I need to add a small dialog that contains a panel which has a checkbox and a couple text fields. When the user clicks on the checkbox I want to disable or enable the checkboxes. This part seems to work well but the text fields are not properly...

Java GUI Crash happens over VNC!!!

Hi!! I have a Java GUI based Application. When I run it on Windows it works fine. But when I am in vnc session to a Linux Box without X11 graphics enabled. Out of 20 runs of the software on an average 1 run fails to bring up the GUI in two different ways, The GUI shrinks to a small square. The GUI doesn't appear at all. ...

Java - Draw a ruler (line with tick marks at 90 degree angle)

Hello all, I'm using Java AWT to draw lines on a panel (Line2D & and Graphics2D.drawLine) and I'm wondering how I can draw a line with tick marks, similar to: |----|----|----|----|----| I know the positions I'd like to draw the ticks at in advance. The lines could be in any position, so the ticks must be drawn at an angle releative t...

Java AWT - Draw a Polygon connected by smooth curved lines

Here I am asking more silly graphics questions. Hopefully soon I will leave the world of graphics behind and plant myself firmly in the color-less middle-tier again. I have a newfound respect for people who are able to fiddle with images in pleasing ways through code. That said, I am drawing a Polygon on a canvas. It can have an arbitra...

Touch screen supported API for desktop development in Java Swing?

Hi all I'm developing a system that will eventually be implemented on a touch-screen supported machines such as HP Touchsmart. Are there any relevant references in java swing api that support flicking pages to scroll up/down (such as in iphone/android phone)? Any general references to any swing api that support touch/multi-touch are a...