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

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

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

JWindow.getRootPane介绍

暂无

代码示例

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public static JRootPane rootPaneForComponent( Component comp )
{
 for( Component p = comp; p != null; p = p.getParent() )
 {
  if( p instanceof JRootPane )
  {
   return (JRootPane)p;
  }
  if( comp instanceof JFrame )
  {
   return ((JFrame)comp).getRootPane();
  }
  if( comp instanceof JDialog )
  {
   return ((JDialog)comp).getRootPane();
  }
  if( comp instanceof JWindow )
  {
   return ((JWindow)comp).getRootPane();
  }
 }
 return null;
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

public static JRootPane rootPaneForComponent( Component comp )
{
 for( Component p = comp; p != null; p = p.getParent() )
 {
  if( p instanceof JRootPane )
  {
   return (JRootPane)p;
  }
  if( comp instanceof JFrame )
  {
   return ((JFrame)comp).getRootPane();
  }
  if( comp instanceof JDialog )
  {
   return ((JDialog)comp).getRootPane();
  }
  if( comp instanceof JWindow )
  {
   return ((JWindow)comp).getRootPane();
  }
 }
 return null;
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

/**
 * @param comp the component to analyze
 *
 * @return the root pane for the component
 */
public static JRootPane rootPaneForComponent( Component comp )
{
 for( Component p = comp; p != null; p = p.getParent() )
 {
  if( p instanceof JRootPane )
  {
   return (JRootPane)p;
  }
  if( comp instanceof JFrame )
  {
   return ((JFrame)comp).getRootPane();
  }
  if( comp instanceof JDialog )
  {
   return ((JDialog)comp).getRootPane();
  }
  if( comp instanceof JWindow )
  {
   return ((JWindow)comp).getRootPane();
  }
 }
 return null;
}

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

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class WindowTest
{
  public static void main(String[] args)
  {

    JFrame frame = new JFrame();
    frame.pack();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//      frame.setLocation(-200, 0); // uncomment this line to hide the dummy frame
    frame.setVisible( true );

    JWindow window = new JWindow(); // this doesn't work
//      JWindow window = new JWindow(frame); // this works

    window.getContentPane().add( new JTextField(10), BorderLayout.NORTH );
    window.getContentPane().add( new JButton("Button") );
    String[] items = { "Select Item", "Color", "Shape", "Fruit" };
    JComboBox mainComboBox = new JComboBox( items );
    window.getContentPane().add( mainComboBox, BorderLayout.SOUTH );

    window.setBounds(50, 50, 200, 200);
    window.setVisible(true);
    window.getRootPane().setBorder(new javax.swing.border.MatteBorder(4, 4, 4, 4, Color.BLUE));
   }
}

代码示例来源:origin: net.lecousin/core

win = new JWindow();
win.setAlwaysOnTop(true);
win.getRootPane().setBorder(new LineBorder(Color.BLACK));
win.getRootPane().getContentPane().setLayout(new BoxLayout(win.getRootPane().getContentPane(), BoxLayout.Y_AXIS));
win.getRootPane().getContentPane().add(logoContainer = new JPanel());
FlowLayout fl = new FlowLayout();
fl.setVgap(0);
fl.setHgap(0);
logoContainer.setLayout(fl);
win.getRootPane().getContentPane().add(titleContainer = new JPanel());
fl = new FlowLayout();
fl.setVgap(0);
fl.setHgap(0);
titleContainer.setLayout(fl);
win.getRootPane().getContentPane().add(bottom = new JPanel());
bottom.setMinimumSize(new Dimension(400, 40));
bottom.setPreferredSize(new Dimension(400, 40));

代码示例来源:origin: javax.help/javahelp

pane = ((JFrame)parent).getRootPane();
} else if (parent instanceof JWindow) {
  pane = ((JWindow)parent).getRootPane();
} else if (parent instanceof JDialog) {
  pane = ((JDialog)parent).getRootPane();

代码示例来源:origin: javax.help/javahelp

private void cancelPopup() {
Container top = getTopMostContainer();
ungrabContainers();
JRootPane root = getRootPane();
if (root != null) {
  root.unregisterKeyboardAction
  (KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
} else if (top != null) {
  top.removeKeyListener(pka);
}
window.removeWindowListener(pwa);
if (on1dot4) {
  try {
  Class types[] = { Class.forName("java.awt.event.WindowFocusListener") };
  Object args[] = { pwa };
  Method m = window.getClass().getMethod("removeWindowFocusListener", types);
  m.invoke(window, args);
  // window.removeWindowFocusListener(pwa);
  } catch (java.lang.Exception ex) {
  //ignore it
  }
}
window.getRootPane().unregisterKeyboardAction
  (KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
window.dispose();
window = null;
jheditor = null;
currentPopup = null;
}

代码示例来源:origin: net.sf.ingenias/editor

jw.getRootPane().setDoubleBuffered(false);
RepaintManager currentManager = RepaintManager.currentManager(jw
    .getRootPane());
boolean dBufferOn = currentManager.isDoubleBufferingEnabled();
jw.getRootPane().repaint();
jw.getRootPane().paint(svgGenerator);

代码示例来源:origin: javax.help/javahelp

window = new JWindow((Window)getTopMostContainer());
  jheditor = new JHelpContentViewer(getHelpModel());
  window.getRootPane().setBorder(BorderFactory.createLineBorder(Color.black, 2));
  top.addKeyListener(pka);
window.getRootPane().registerKeyboardAction(this, "cancel",
            KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

代码示例来源:origin: org.jclarion/clarion-runtime

configureColor(jw, target);
  con = jw.getContentPane();
  root = jw.getRootPane();
} else {
  JDialog jd;

相关文章