Difference between java.exe and javaw.exe
when i mouse-over it, it loses the color that i have set for it. This is because MetalTheme of MetalLookAndFeel ignores BasicLookAndFeel color settings as follows. /* @see javax/swing/plaf/metal/MetalIconFactory.java */ class MenuArrowIcon implements Icon {...
Getting a HeadlessException: No X11 DISPLAY variable was set
error upon assigning Layout: BoxLayout can’t be shared
To draw a rectangle in Swing you should: First of all, never draw directly in the JFrame or other top-level window. Instead draw in a JPanel, JComponent or other...
If you have an java.awt.Image, rezising it doesn’t require any additional libraries. Just do: Image newImage = yourImage.getScaledInstance(newWidth, newHeight, Image.SCALE_DEFAULT); Ovbiously, replace newWidth and newHeight with the dimensions of the specified image.Notice the last parameter: it tells...
Java: Rotating Images
You should actually take the result from the option pane: dialogButton = JOptionPane.showConfirmDialog (null, "Are you sure?","WARNING", dialogButton); Otherwise, it remains set to JOptionPane.YES_NO_OPTION. Cleaner would be: if (JOptionPane.showConfirmDialog(null,...
How do I draw a triangle?
Usage depends on whether the component’s parent has a layout manager or not. setSize() — use when a parent layout manager does not exist; setPreferredSize() (also its related setMinimumSize and setMaximumSize) — use when...