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

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

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

JInternalFrame.add介绍

暂无

代码示例

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

// Your JInternal Frame
JInternalFrame inFrame = new JInternalFrame("", true, true, true, true);

// Your JFileChooser
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));

// put filechooser in internal frame
inFrame.add(fileChooser);

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

final JInternalFrame internalFrame = new JInternalFrame("",true,true);  
tx = new JTextArea();
internalFrame.add(tx);
i+=1;
internalFrame.setName("Document"+i);

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

frame.add(component);
frame.pack();
final Dimension size = frame.getMinimumSize();

代码示例来源: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

JInternalFrame frame = new JInternalFrame("Report", true, true, true, true);
frame.add(new ScrollPane(viewer));
try {
  frame.setSelected(true);
 } catch (java.beans.PropertyVetoException e) {
 }

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

JInternalFrame cir=new JInternalFrame("Circuit",true,true,false,false);
Board b=new Board();
JScrollPane scroll=new JScrollPane(b);
cir.add(scroll)
this.add(cir);

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

JInternalFrame jInternalFrame = new JInternalFrame("Hello!",true,true,true,false);
  jInternalFrame.setSize(160,200);
  getContentPane().add(jInternalFrame);
  jInternalFrame.add(panel);
  jInternalFrame.setVisible(true);

代码示例来源: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

//JDesktopPane desktop = new JDesktopPane();
JInternalFrame internalFrame = new JInternalFrame("PDFAnnotation" + index, true, true, true, true);

internalFrame.setBounds(0, 0, 600, 100);

desktop.add(internalFrame);

PDFPanel p = new PDFPanel();
JPanel e = p.getJPanel();
internalFrame.add(e, BorderLayout.CENTER);
internalFrame.setVisible(true);
//this.add(desktop, BorderLayout.CENTER);

代码示例来源: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: stackoverflow.com

public class ViewAction extends AbstractAction {

  private JDesktopPane desktop;
  private Class<? extends JComponent> view;

  public ViewAction(JDesktopPane desktop, Class<? extends JComponent> view) {
    this.desktop = desktop;
    this.view = view;
  }

  @Override
  public void actionPerformed(ActionEvent e) {
    try {
      countFrames++;
      JInternalFrame jf = new JInternalFrame("Add Owner", true, true, true, true);
      JComponent viewComponent = view.newInstance();
      jf.add(viewComponent);
      jf.pack();
      jf.setLocation(countFrames * 10, countFrames * 20);
      jf.setVisible(true);
      desktop.add(jf);
    } catch (InstantiationException | IllegalAccessException ex) {
      ex.printStackTrace();
    }
  }

}

代码示例来源:origin: com.googlecode.gstreamer-java/gstreamer-java

player.setPreferredSize(new Dimension(640, 480));
player.setControlsVisible(true);
frame.add(player, BorderLayout.CENTER);
frame.pack();
panel.add(frame);

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

/**
 * Adds command line window to main frame.
 * 
 * @param desktop
 *            OVTK2Desktop to host command line
 */
private void initCommandLine(OVTK2Desktop desktop) {
  if (console == null || console.isClosed()) {
    console = new RegisteredJInternalFrame(Config.language.getProperty("Menu.Tools.Console"), "Tools", Config.language.getProperty("Menu.Tools.Console"), true, true, true, true);
    console.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
    console.setSize(600, 100);
    try {
      OutputPrinter c = OVTKScriptingInitialiser.getCommandLine();
      JScrollPane scrollingArea = new JScrollPane((Component) c);
      scrollingArea.setMinimumSize(new Dimension(0, 35));
      console.add(scrollingArea);
    } catch (RuntimeException e) {
      ErrorDialog.show(e);
    }
    desktop.display(console, Position.centered);
    console.setVisible(true);
  } else {
    console.setVisible(true);
    console.toFront();
  }
}

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

/**
 * List windows known to this desktop.
 */
private void listWindows() {
  final Component[] components = getComponents();
  final String[] titles = new String[components.length];
  for (int i=0; i<components.length; i++) {
    Component c = components[i];
    String title = String.valueOf(c.getName());
    if (c instanceof JInternalFrame) {
      final JInternalFrame ci = (JInternalFrame) c;
      title = String.valueOf(ci.getTitle());
      c = ci.getRootPane().getComponent(0);
    }
    final Dimension size = c.getSize();
    titles[i] = title + " : " + c.getClass().getSimpleName() +
        '[' + size.width + " \u00D7 " + size.height + ']';
  }
  final JInternalFrame frame = new JInternalFrame("Windows", true, true, true, true);
  frame.add(new JScrollPane(new JList<>(titles)));
  frame.pack();
  frame.setVisible(true);
  add(frame);
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

public void cmdToFrame(JScrollPane scrollingArea) {
  frame.remove(scrollingArea);
  JInternalFrame cmdFrame = new RegisteredJInternalFrame("Scripting", "Console", "Command console", true, false, false, true);
  cmdFrame.add(scrollingArea);
  cmdFrame.setVisible(true);
  cmdFrame.pack();
  int height = frame.getSize().height / 4;
  int width = 1000;
  int yPosition = frame.getSize().height - height;
  if (height < 68) {
    height = 68;
    yPosition = 0;
  }
  if (width > frame.getSize().width) {
    width = frame.getSize().width;
  }
  scrollingArea.getViewport().setPreferredSize(new Dimension(width, height));
  cmdFrame.setSize(width, height);
  cmdFrame.setLocation(-4, yPosition - 87);
  desktop.add(cmdFrame);
}

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

internalFrame1.add(t.getContentPane());
internalFrame1.pack();

代码示例来源: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类方法