Using JInternalFrame and some button

I don’t know a way to put a JButton directly on a JDesktopPane, but you can use menu items to create and select a JInternalFrame. In this example, each menu item uses an Action defined in the JInternalFrame to select the corresponding frame. class MyFrame extends JInternalFrame { private Action action; MyFrame(JDesktopPane desktop, String name, … Read more

Minimizing Jinternal Frame without clicking the button

works as I expected, you have to check JInternalFrame#isIconifiable() (eeerght this Veto is really ****) import java.awt.*; import java.awt.event.*; import java.beans.PropertyVetoException; import javax.swing.*; import javax.swing.plaf.basic.*; public class InternalFrameUnMovable extends JFrame { private static final long serialVersionUID = 1L; public JDesktopPane desktop; public InternalFrameUnMovable() { desktop = new JDesktopPane(); getContentPane().add(desktop); desktop.add(createInternalFrame(1, Color.RED)); desktop.add(createInternalFrame(2, Color.GREEN)); desktop.add(createInternalFrame(3, Color.BLUE)); … Read more

CubicCurve2D connecting two JInternalFrame instances

Yes. Here’s an example using drawLine(int x1, int y1, int x2, int y2), but invoking draw(Shape s) on your curve is a straightforward extension. You may have to expand the ComponentAdapter to handle resize events, too. import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Stroke; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import … Read more