javax.swing.JFrame.getRootPane()方法的使用及代码示例

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

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

JFrame.getRootPane介绍

暂无

代码示例

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

frame.getContentPane().add(submitPanel, BorderLayout.SOUTH);
frame.setVisible(true);
frame.getRootPane().setDefaultButton(start);
start.requestFocus();

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

_logMonitorFrame.getRootPane().setJMenuBar(createMenuBar());
_logMonitorFrame.getContentPane().add(splitPane, BorderLayout.CENTER);
_logMonitorFrame.getContentPane().add(createToolBar(),

代码示例来源:origin: wiztools/rest-client

jl_url.setLabelFor(jcb_url);
jl_url.setDisplayedMnemonic('u');
rest_ui.getFrame().getRootPane().setDefaultButton(jb_request);
rest_ui.getFrame().getRootPane().setDefaultButton(jb_request);
jb_request.addActionListener(new ActionListener() {
  @Override

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

frame.getRootPane().setDefaultButton(put_button);
frame.setVisible(true);
setTitle("ReplCacheDemo");

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

f.setTitle("Echo " + kind);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getRootPane().setDefaultButton(send);
f.add(tf, BorderLayout.NORTH);
f.add(new JScrollPane(ta), BorderLayout.CENTER);

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

f.getRootPane().setDefaultButton(b);
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Q, 0), EXIT);
this.getActionMap().put(EXIT, exit);

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

JFrame frame = new JFrame(...);
frame.setUndecorated( true );
frame.getRootPane().setBorder( new MatteBorder(4, 4, 4, 4, Color.BLUE) );

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

public class Overlay {

  public static void main(String[] args) {
    JFrame frame = new JFrame("Transparent Window");
    frame.setUndecorated(true);
    frame.setBackground(new Color(0, 0, 0, 0));
    frame.setAlwaysOnTop(true);
    // Without this, the window is draggable from any non transparent
    // point, including points  inside textboxes.
    frame.getRootPane().putClientProperty("apple.awt.draggableWindowBackground", false);

    frame.getContentPane().setLayout(new java.awt.BorderLayout());
    frame.getContentPane().add(new JTextField("text field north"), java.awt.BorderLayout.NORTH);
    frame.getContentPane().add(new JTextField("text field south"), java.awt.BorderLayout.SOUTH);
    frame.setVisible(true);
    frame.pack();
  }
}

代码示例来源:origin: haraldk/TwelveMonkeys

public void run() {
    JFrame frame = new JFrame(pTitle);
    frame.getRootPane().getActionMap().put("window-close", new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        Window window = SwingUtilities.getWindowAncestor((Component) e.getSource());
        window.setVisible(false);
        window.dispose();
      }
    });
    frame.getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "window-close");
    frame.addWindowListener(new ExitIfNoWindowPresentHandler());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setLocationByPlatform(true);
    JPanel pane = new JPanel(new BorderLayout());
    JScrollPane scroll = new JScrollPane(pImage != null ? new ImageLabel(pImage) : new JLabel("(no image data)", JLabel.CENTER));
    scroll.setBorder(null);
    pane.add(scroll);
    frame.setContentPane(pane);
    frame.pack();
    frame.setVisible(true);
  }
});

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

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Borders2UndecoFrame extends JFrame{
  JLabel label = new JLabel("Welcome!", JLabel.CENTER);
  public Borders2UndecoFrame(){
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(new Dimension(200, 200));
    add(label, BorderLayout.CENTER);
    setUndecorated(true);
    getRootPane().setBorder(BorderFactory.createMatteBorder(4, 4, 4, 4, Color.RED));
    setVisible(true);

  }
  public static void main(String[] args) {
    new Borders2UndecoFrame();
  }

}

代码示例来源:origin: camunda/camunda-bpm-platform

_logMonitorFrame.getRootPane().setJMenuBar(createMenuBar());
_logMonitorFrame.getContentPane().add(splitPane, BorderLayout.CENTER);
_logMonitorFrame.getContentPane().add(createToolBar(),

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

JFrame frame = new JFrame("funny ...") {
   @Override
   public void paint(Graphics g) {
     super.paint(g);
     g.drawString("for test", 150, 150);
   }
 };
 frame.getRootPane().setOpaque(false);
 ((JComponent) frame.getContentPane()).setOpaque(false);

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime

/**
 * Puts {@code Window} bounds to client property.
 * @param window the target {@code Window}
 * @param bounds bounds
 */
public static void putWindowNormalBounds(Window window, Rectangle bounds) {
  if (window instanceof JFrame) {
    ((JFrame) window).getRootPane().putClientProperty(
        WINDOW_STATE_NORMAL_BOUNDS, bounds);
  }
}

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

JFrame frame = new JFrame("Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(100, 100);
frame.setUndecorated(true);
frame.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
frame.setVisible(true);

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

public TemporaryFocusTracker( JFrame jf )
  {
    this.jf	= jf;
//        addContainer( jf.getContentPane() );
    jf.getRootPane().addAncestorListener( this );
  }

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

@Override
public void setWaitingCursor(final boolean waiting) {
  if (waiting) {
    frame.getRootPane().getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    frame.getRootPane().getGlassPane().setVisible(true);
  }
  else {
    frame.getRootPane().getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    frame.getRootPane().getGlassPane().setVisible(false);
  }
}

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

public void dispose()
{
  removeContainer( jf.getContentPane() );
  jf.getRootPane().removeAncestorListener( this );
}

代码示例来源:origin: kaikramer/keystore-explorer

/**
 * Set cursor to busy and disable application input. This can be reversed by
 * a subsequent call to setCursorFree.
 *
 * @param frame
 *            Frame to apply to
 */
public static void setCursorBusy(JFrame frame) {
  setCursorBusy(frame.getRootPane().getGlassPane());
}

代码示例来源:origin: kaikramer/keystore-explorer

/**
 * Set cursor to free and enable application input. Called after a call to
 * setCursorBusy.
 *
 * @param frame
 *            Frame to apply to
 */
public static void setCursorFree(JFrame frame) {
  setCursorFree(frame.getRootPane().getGlassPane());
}

代码示例来源:origin: omegat-org/omegat

/**
 * Make a dialog closeable by pressing the Esc key.
 * {@link JFrame#dispose()} will be called.
 *
 * @param frame
 */
public static void setEscapeClosable(JFrame frame) {
  setEscapeAction(frame.getRootPane(), makeCloseAction(frame));
}

相关文章

JFrame类方法