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

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

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

JInternalFrame.toFront介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

for (JInternalFrame frame : windows) {
  if (frame.getTitle().equals("Waiting for players")) {
    frame.toFront();
    frame.setVisible(true);
    try {

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

public void toFront() {
  if ( frame != null )
    frame.toFront();
  else
  if ( iframe != null )
    iframe.toFront();
}

代码示例来源:origin: joel-costigliola/assertj-swing

/**
 * Brings the given {@code JInternalFrame} to the front.
 *
 * @param internalFrame the target {@code JInternalFrame}.
 */
@RunsInEDT
public void moveToFront(final @Nonnull JInternalFrame internalFrame) {
 execute(() -> // it seems that moving to front always works, regardless if the internal frame is invisible and/or
        // disabled.
 internalFrame.toFront());
}

代码示例来源:origin: de.sciss/scisslib

public void toFront()
  {
//if( lala ) {
//    System.out.println( "toFront" );
//    new Exception().printStackTrace();
//}
//        
    if( w != null ) {
      w.toFront();
    } else if( jif != null ) {
      jif.toFront();
      try {
        jif.setSelected( true );
      } catch( PropertyVetoException e ) { /* ignored */ }
    } else {
      throw new IllegalStateException();
    }
  }

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

/**
 * Adds the given {@link JInternalFrame} to the given {@link JDesktopPane} and bring it to the
 * front.
 *
 * @param desktopPane
 *            the desktop pane
 * @param internalFrame
 *            the internal frame
 */
public static void addJInternalFrame(final JDesktopPane desktopPane,
  final JInternalFrame internalFrame)
{
  desktopPane.add(internalFrame);
  internalFrame.setVisible(true);
  internalFrame.toFront();
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = TO_FRONT_JSDOC)
public void toFront() {
  if (surface != null) {
    if (surface instanceof JInternalFrame) {
      try {
        ((JInternalFrame) surface).setIcon(false);
      } catch (Exception e) {
      }
      ((JInternalFrame) surface).toFront();
    } else if (surface instanceof JFrame) {
      ((JFrame) surface).toFront();
    }
  }
}
private static final String GET_MINIMIZED_JSDOC = ""

代码示例来源:origin: locationtech/jts

/**
 * Workaround for bug: can't re-show internal frames. See bug parade 4138031.
 */
public static void show(JInternalFrame internalFrame, JDesktopPane desktopPane)
  throws PropertyVetoException {
  if (!desktopPane.isAncestorOf(internalFrame))
    desktopPane.add(internalFrame);
  internalFrame.setClosed(false);
  internalFrame.setVisible(true);
  internalFrame.toFront();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
  * Description of the Method
  *
  * @param e  Description of Parameter
  */
 public void mouseDragged(MouseEvent e) {
  try {
   // do not resize the frame if it is shaded
   JComponent pane = getNorthPane();
   if (e.getSource()==frame &&
     pane instanceof SkinTitlePane &&
     ((SkinTitlePane) pane).getWindow().isShaded()) {
    return;
   }
   super.mouseDragged(e);
  } catch (NullPointerException ex) {
   // the nullpointerexception may be thrown by bug id 4383371
   // if parentBounds is not set
   // sending the frame back and front should fix the problem as an Ancestor propertychangeevent
   // will be sent
   // this bug has been fixed in JDK1.3
   // http://developer.java.sun.com/developer/bugParade/bugs/4383371.html
   ((JInternalFrame) e.getSource()).toBack();
   ((JInternalFrame) e.getSource()).toFront();
  }
 }
}

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

Administrator.getDesktop().add(viewFrame);
viewFrame.setVisible(true);
viewFrame.toFront();

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

private void bringToFront(Component existing) {
  existing.setVisible(true);
  existing.show();
  if (existing instanceof Frame) {
    Frame frame = (Frame) existing;
    frame.toFront();
    return;
  }
  if (existing instanceof JInternalFrame) {
    JInternalFrame frame = (JInternalFrame) existing;
    frame.toFront();
    return;
  }
  if (existing instanceof JPanel) {
    JPanel frame = (JPanel) existing;
    BoxPanelSwitchableView bpsv = Utility.getBoxPanelTabPane();
    if (bpsv.containsComponent(frame)) {
      bpsv.setSelectedComponent(frame);
      return;
    }
    bpsv.addComponent(frame.getName(), frame, DisplayType.PANEL);
    return;
  }
  Debuggable.notImplemented();
}

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

/**
 * Adds a given JInternalFrame to the desktop and centers it.
 * 
 * @param internal
 *            JInternalFrame to be displayed centered
 */
protected void displayCentered(JInternalFrame internal) {
  // do the location calculation
  Rectangle visible = this.getDesktopPane().getVisibleRect();
  Dimension size = internal.getSize();
  internal.setLocation((visible.width / 2) - (size.width / 2), (visible.height / 2) - (size.height / 2));
  // add to desktop and show
  this.getDesktopPane().add(internal);
  internal.setVisible(true);
  internal.toFront();
}

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

@Override
public void start(File file) {
  this.file = file;
  OVTK2Desktop desktop = OVTK2Desktop.getInstance();
  JOptionPane
      .showInternalMessageDialog(
          desktop.getDesktopPane(),
          "To export appearance of the graph, please make sure you saved appearance first.",
          "Info", JOptionPane.INFORMATION_MESSAGE);
  // add GUI to desktop
  JDesktopPane pane = desktop.getDesktopPane();
  initGUI();
  pane.add(gui);
  gui.setVisible(true);
  gui.toFront();
}

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

public void selectNextWindow() {
  JDesktopPane desktop = OVTK2Desktop.getInstance().getDesktopPane();
  JInternalFrame[] frames = desktop.getAllFrames();
  for (int i = 0; i < frames.length; i++) {
    if (frames[i].isSelected()) { /*
                   * find next frame that isn't an icon
                   * and can be selected
                   */
      try {
        int next = i + 1;
        // check just in case
        if (next > i)
          return;
        while (next != i && frames[next].isIcon())
          next++;
        if (next == i)
          return;
        // all other frames are icons or veto selection
        frames[next].setSelected(true);
        frames[next].toFront();
        return;
      } catch (PropertyVetoException e) {
      }
    }
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = MAXIMIZE_JSDOC)
public void maximize() {
  if (surface != null) {
    if (surface instanceof JFrame) {
      ((JFrame) surface).setExtendedState(JFrame.MAXIMIZED_BOTH);
    } else if (surface instanceof JInternalFrame) {
      JInternalFrame aFrame = (JInternalFrame) surface;
      try {
        if (aFrame.isIcon()) {
          aFrame.setIcon(false);
        }
        if (!aFrame.isMaximum() && aFrame.isMaximizable()) {
          aFrame.setMaximum(true);
          aFrame.toFront();
        }
      } catch (Exception e) {
      }
    }
  }
}
private static final String RESTORE_JSDOC = ""

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = RESTORE_JSDOC)
public void restore() {
  if (surface != null) {
    if (surface instanceof JInternalFrame) {
      JInternalFrame aFrame = (JInternalFrame) surface;
      try {
        if (aFrame.isMaximum()) {
          aFrame.setMaximum(false);
        }
        if (aFrame.isIcon()) {
          aFrame.setIcon(false);
        }
      } catch (Exception e) {
      }
      aFrame.toFront();
    } else if (surface instanceof JFrame) {
      ((JFrame) surface).setExtendedState(JFrame.NORMAL);
      ((JFrame) surface).toFront();
    }
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

} else if (rpContainer instanceof JInternalFrame) {
  JInternalFrame frame = (JInternalFrame) rpContainer;
  frame.toFront();
  try {
    frame.setSelected(true);

代码示例来源: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();
}

代码示例来源: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();
}

相关文章

JInternalFrame类方法