awt

Set component look and feel

I'm using substance look and feel as my application default look and feel, however I want to set the system look and feel for FileDialog especially in Mac OS. Is it possible to set FileDialog to use look and feel other than the application look and feel? Thanks ...

Why does BorderLayout overwrite components when new ones are added?

BorderLayout does something strange. If I add two panels to a Container with the same constraint (BorderLayout.CENTER for instance), then the first one goes away, even if the second one is deleted or made invisible It seems as though it would make sense for it to "stack" each element on top of the previous ones. Is this correct and by ...

Java - filling an overlapping polygon

I'm trying to draw a 5 point star in AWT. Each point in the 2d grid is 72 degrees apart - so I thought I could draw the polygon using only 5 points by ordering the points 144 degrees apart, so the polygon gets fed the points in order 1,3,5,2,4 Unfortunately, this involves a lot of intersecting lines, and the end result is that there are...

Java Awt Paint Method's Variable Inconsistency

I'm not sure what is wrong but there's some weird happening in my Paint() concerning some variables. this code works just fine: public void paint(Graphics g) { Point[] positions = {new Point(20,50),new Point(60,30),new Point(80,20),new Point(80,30)}; } but this one don't, i wanted this one, because im changing position formations...

java.awt.Checkbox disabled appearance inconsistent with XP

I'm a hobbyist programmer. My disabled AWT Checkbox with label passed in constructor is not being displayed how I think it should on my WindowsXP x64 machine. The text label gets grayed out, but the actual checkbox area background remains white. I expected it to have a gray background like when it is in the mousePressed state. The Swing ...

What are the UIManager keys for JFileChooser and FileDialog?

I want to use the UIManager.get method in order to get and save the system look and feel for JFileChooser and FileDialog and then I want to change the look and feel. The problem is that I don't know what are the keys for Swing components that UIManager.get method uses. Is there any reference or any convention for that? Thanks ...

java.awt , swing, and APACHE POI for Power Point Presentation

I'm trying to use SlideShow to create presentation... http://poi.apache.org/apidocs/org/apache/poi/hslf/usermodel/SlideShow.html and I see some uses of java.awt classes in the examples. My question is: to what extent awt can be used in creating PPT using POI? further, how swing can be used together with Apache POI? Could some exper...

Prevent Enter Event from Bubbling to to Main Window

I have a custom Swing component called NavigationLink which extends JLabel and implements a key event listener like so: addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { boolean actionInvoked = e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_SPACE; if (actionInvoked && Navig...

Using JSplitPane with an AWT component

I have an AWT canvas which I cannot convert to a Swing component (it comes from VTK). I wish to display a few of these canvases inside of a JSplitPane. I've read about mixing heavy and light weight components in Java and know that it's a pain in the butt, but I don't have a choice. If I wrap the AWT canvas inside of a JPanel and then ...

TextLayout getAscent getDescent

I'am actually using TextLayouts to display. I create a textLayout for each line of my text and place them using getAscent() and getDescent() methods. All the line of the text are using the same police, so the different textLayouts too. I would like to know if the getAscent() et getDescent() are constants for a given police. Or if they c...

Create an image from a non-visible AWT Component?

I'm trying to create an image (screen-shot) of a non-visible AWT component. I can't use the Robot classes' screen capture functionality because the component is not visible on the screen. Trying to use the following code: BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraph...

Convert 2-dim java.awt.Color Array to image (png/jpg)

I have a Color[][] Array which holds the information of an image. Array[0][0] is the lowest leftmost pixel. I can draw the picture on the screen. I also want to save it as file (png/jpg). But how? ...

javax print vs java awt print api

Can i use java awt print to print a document/file instead of using javax print? I could find that in java awt print there is an option to set the content to be printed only as string using AttributedString. Is there an option to use awt and print document/file from input stream instead of String? ...

Printing in Java using PS file

The have a generated post script file and i want to print using it. How can it be achieved in java either using java print API or awt. Is it possible? ...

Readding panel to layout after editing panel?

Hi, What I'm trying to do is dynamicly edit a panel and readd it to the (Border)layout. The panel contains textfields and I want the user to be able to add or remove textfields to the panel. What I tried is the following: remove the panel from the layout, add another textfield to the panel, readd the panel to the layout. However this do...