internaFrame.pack(); internaFrame.setVisible(true);
((JDesktopPane) owner).add(frame); frame.getContentPane().add(panel); frame.pack(); return frame;
public void run() { window.pack(); } } );
public void pack() { if(useDesktop) { jInternalFrame.pack(); } else { jFrame.pack(); } }
/** * Adds the given {@link Component} object to the given {@link JInternalFrame} object. * * @param internalFrame * the {@link JInternalFrame} object. * @param component * the {@link Component} object to add */ public static void addComponentToFrame(final JInternalFrame internalFrame, final Component component) { internalFrame.add(component, BorderLayout.CENTER); internalFrame.pack(); }
ChartPanel cp = new ChartPanel(chart); JInternalFrame jif = new JInternalFrame("Chart", ...); jif.add(cp); jif.pack(); jif.setVisible(true);
import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JInternalFrame; import javax.swing.JPanel; public class AboutFrame extends JInternalFrame{ public AboutFrame() { add(new Panel()); pack(); } private class Panel extends JPanel { protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawString("About Screen", 100, 100); } public Dimension getPreferredSize(){ return new Dimension(300, 300); } } }
/** * Adds the given {@link View} object to the given {@link JInternalFrame} object. * * @param internalFrame * the {@link JInternalFrame} object. * @param view * the {@link View} object to add. * @deprecated use instead {@link JInternalFrameExtensions#addViewToFrame(JInternalFrame, View)} */ @Deprecated public static void setViewAndControllerForJInternalFrame(final JInternalFrame internalFrame, final View<?, ?> view) { internalFrame.add(view.getComponent(), BorderLayout.CENTER); internalFrame.pack(); }
/** * Adds the given {@link View} object to the given {@link JInternalFrame} object. * * @param internalFrame * the {@link JInternalFrame} object. * @param view * the {@link View} object to add */ public static void addViewToFrame(final JInternalFrame internalFrame, final View<?, ?> view) { internalFrame.add(view.getComponent(), BorderLayout.CENTER); internalFrame.pack(); }
private int count; desktop.add(createInternalFrame(++count)); private JInternalFrame createInternalFrame(int number) { JInternalFrame jif = new JInternalFrame( "F" + number, true, true, true, false); int topLeft = 25 * number; jif.add(new JTextField(String.valueOf(number), 8)); jif.pack(); jif.setLocation(topLeft, topLeft); jif.setVisible(true); return jif; }
public void pack() { boolean old=isResizable(); setResizable(true); super.pack(); setResizable(old); }
public void mouseClicked(MouseEvent _evt) { if(BuLib.isMiddle(_evt)&&BuLib.isSingleClick(_evt)) { JInternalFrame f=getTop(); if(f!=null) f.pack(); } }
private void updateNetworkFrameSize(final CyNetworkView view, int width, int height, boolean resizable) { final JInternalFrame frame = presentationContainerMap.get(view); if (frame == null) return; if (width > 0 && height > 0) { if(width != frame.getContentPane().getWidth() && height != frame.getContentPane().getHeight()) { frame.getContentPane().setPreferredSize(new Dimension(width, height)); frame.pack(); } } frame.setResizable(resizable); frame.setMaximizable(resizable); }
asd t = new asd(); JInternalFrame internalFrame = new JInternalFrame(); internalFrame.setContentPane(t.getContentPane()); internalFrame.pack(); // set the internalFrame's location // ... internalFrame.setVisible(true); dskp.add(internalFrame);
public void actionPerformed( ActionEvent ev) { JInternalFrame jif = new JInternalFrame( "The Long Titled Internal Frame, n� (this is to test \"strange caracters\" titles)" + pos / 5, true, true, true, true); jif.setVisible( true); jif.setFrameIcon( nextIcon()); jif.setIconifiable( true); jif.setMaximizable( true); jif.setClosable( true); JButton but = new JButton( "Change Icon"); but.addActionListener( new dummy( jif)); jif.getContentPane().add( new JLabel( "Another InternalFrame")); jif.getContentPane().add( but, BorderLayout.SOUTH); jif.setLocation( new Point( pos, pos)); pos += 5; jif.pack(); desktop.add( jif); try { jif.setSelected( true); } catch ( PropertyVetoException e) {} } }
public void actionPerformed(ActionEvent e) { dialog.pack(); dialog.setLocation(desktop.getWidth()-dialog.getWidth(),0); dialog.show(); try { dialog.setSelected(true); } catch (java.beans.PropertyVetoException ex) {} } });
/** To be useful here, a MailComposeBean has to be inside * its own little JInternalFrame. */ public MailComposeBean newSend() { // Make the JInternalFrame wrapper JInternalFrame jf = new JInternalFrame(); // Bake the actual Bean MailComposeBean newBean = new MailComposeBean(this, "Compose", 400, 250); // Arrange them on the diagonal. jf.setLocation(nx+=10, ny+=10); // Make the new Bean be the contents of the JInternalFrame jf.setContentPane(newBean); jf.pack(); jf.toFront(); // Add the JInternalFrame to the JDesktopPane dtPane.add(jf); return newBean; }
@Override protected void setupConsole() { final JInternalFrame frame = new JInternalFrame("Console"); desktopPane.add(frame); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setContentPane(getConsolePane().getComponent()); frame.setJMenuBar(createConsoleMenu()); frame.pack(); getConsolePane().setWindow(frame); }
/** * Creates and shows a new internal frame for the given image. */ final void addImage(final RenderedImage image, final String title) { final JInternalFrame internal = new JInternalFrame(title, true, true); internal.add(new ImagePanel(image)); internal.pack(); internal.show(); desktop.add(internal); if (location > min(desktop.getWidth() - internal.getWidth(), desktop.getHeight() - internal.getHeight())) { location = 0; } internal.setLocation(location, location); location += 30; internal.toFront(); }
/** * Creates and shows a new internal frame for the given image. */ private void addImage(final RenderedImage image, final String title) { final JInternalFrame internal = new JInternalFrame(title, true, true); internal.add(new ImagePanel(image)); internal.pack(); internal.show(); desktop.add(internal); if (location > min(desktop.getWidth() - internal.getWidth(), desktop.getHeight() - internal.getHeight())) { location = 0; } internal.setLocation(location, location); location += 30; internal.toFront(); }