javax.swing.JInternalFrame.pack()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(242)

本文整理了Java中javax.swing.JInternalFrame.pack()方法的一些代码示例,展示了JInternalFrame.pack()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JInternalFrame.pack()方法的具体详情如下:
包路径:javax.swing.JInternalFrame
类名称:JInternalFrame
方法名:pack

JInternalFrame.pack介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

internaFrame.pack();
internaFrame.setVisible(true);

代码示例来源:origin: geotools/geotools

((JDesktopPane) owner).add(frame);
frame.getContentPane().add(panel);
frame.pack();
return frame;

代码示例来源:origin: com.numdata/numdata-swing

public void run()
  {
    window.pack();
  }
} );

代码示例来源:origin: antlr/antlrworks

public void pack() {
  if(useDesktop) {
    jInternalFrame.pack();
  } else {
    jFrame.pack();
  }
}

代码示例来源:origin: de.alpharogroup/swing-components

/**
 * 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();
}

代码示例来源:origin: stackoverflow.com

ChartPanel cp = new ChartPanel(chart);
JInternalFrame jif = new JInternalFrame("Chart", ...);
jif.add(cp);
jif.pack();
jif.setVisible(true);

代码示例来源:origin: stackoverflow.com

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);
    }
  }
}

代码示例来源:origin: de.alpharogroup/swing-components

/**
 * 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();
}

代码示例来源:origin: de.alpharogroup/swing-components

/**
 * 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();
}

代码示例来源:origin: stackoverflow.com

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;
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public void pack()
{
 boolean old=isResizable();
 setResizable(true);
 super.pack();
 setResizable(old);
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public void mouseClicked(MouseEvent _evt)
{
 if(BuLib.isMiddle(_evt)&&BuLib.isSingleClick(_evt))
 {
  JInternalFrame f=getTop();
  if(f!=null) f.pack();
 }
}

代码示例来源:origin: org.cytoscape/swing-application-impl

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);
}

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: net.sf.nimrod/nimrod-laf

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) {}
 }
}

代码示例来源:origin: net.sf.jung/jung-samples

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) {}
  }
});

代码示例来源:origin: IanDarwin/javasrc

/** 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;
}

代码示例来源:origin: org.scijava/scijava-ui-swing

@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);
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * 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();
}

代码示例来源:origin: apache/sis

/**
 * 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();
}

相关文章

JInternalFrame类方法