本文整理了Java中javax.swing.JFrame.setUndecorated()
方法的一些代码示例,展示了JFrame.setUndecorated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.setUndecorated()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:setUndecorated
暂无
代码示例来源:origin: stackoverflow.com
frame.setUndecorated(true);
代码示例来源:origin: stackoverflow.com
// to start with
JPanel myUI = createUIPanel();
JFrame frame = new JFrame();
frame.add(myUI);
// .. and later ...
JFrame newFrame = new JFrame();
newFrame.setUndecorated();
newFrame.add(myUI);
代码示例来源: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: stackoverflow.com
public final class ScreenSaver {
public static final void main(final String[] args) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
final JFrame screenSaverFrame = new JFrame();
screenSaverFrame.setDefaultCloseOperation(
WindowConstants.EXIT_ON_CLOSE);
screenSaverFrame.setUndecorated(true);
screenSaverFrame.setResizable(false);
screenSaverFrame.add(new JLabel("This is a Java Screensaver!",
SwingConstants.CENTER), BorderLayout.CENTER);
screenSaverFrame.validate();
GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice()
.setFullScreenWindow(screenSaverFrame);
}
}
代码示例来源:origin: nodebox/nodebox
/**
* Register for special events available on the Mac, such as showing the about screen,
* showing the preferences or double-clicking a file.
*
* @throws RuntimeException if the adapter methods could not be loaded.
*/
private void registerForMacOSXEvents() throws RuntimeException {
if (!Platform.onMac()) return;
try {
// Generate and register the OSXAdapter, passing it a hash of all the methods we wish to
// use as delegates for various com.apple.eawt.ApplicationListener methods
OSXAdapter.setQuitHandler(this, getClass().getDeclaredMethod("quit", (Class[]) null));
OSXAdapter.setAboutHandler(this, getClass().getDeclaredMethod("showAbout", (Class[]) null));
OSXAdapter.setPreferencesHandler(this, getClass().getDeclaredMethod("showPreferences", (Class[]) null));
OSXAdapter.setFileHandler(this, getClass().getDeclaredMethod("readFromFile", String.class));
} catch (Exception e) {
throw new RuntimeException("Error while loading the OS X Adapter.", e);
}
// On the Mac, if all windows are closed the menu bar will be empty.
// To solve this, we create an off-screen window with the same menu bar as visible windows.
hiddenFrame = new JFrame();
hiddenFrame.setJMenuBar(new NodeBoxMenuBar());
hiddenFrame.setUndecorated(true);
hiddenFrame.setSize(0, 0);
hiddenFrame.setLocation(-100, -100);
hiddenFrame.pack();
hiddenFrame.setVisible(true);
}
代码示例来源:origin: stackoverflow.com
JFrame fr = new JFrame();
fr.setResizable(false);
if (!fr.isDisplayable()) {
// Can only do this when the frame is not visible
fr.setUndecorated(true);
}
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
try {
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(fr);
} else {
// Can't run fullscreen, need to bodge around it (setSize to screen size, etc)
}
fr.setVisible(true);
// Your business logic here
} finally {
gd.setFullScreenWindow(null);
}
代码示例来源:origin: RaiMan/SikuliX2
frame.setUndecorated(true);
frame.setBackground(new Color(0, 0, 0, 0.1f));
代码示例来源:origin: RaiMan/SikuliX2
public static JFrame getFrame(Object... args) {
int x = Do.on().getCenter().x;
int y = Do.on().getCenter().y;
if (args.length > 0) {
Object point = args[0];
if (point instanceof Point) {
x = ((Point) point).x;
y = ((Point) point).y;
} else if (point instanceof Frame) {
return (JFrame) point;
} else {
x = ((Element) point).getCenter().x;
y = ((Element) point).getCenter().y;
}
}
JFrame anchor = new JFrame();
anchor.setAlwaysOnTop(true);
anchor.setUndecorated(true);
anchor.setSize(1, 1);
anchor.setLocation(x, y);
anchor.setVisible(true);
return anchor;
}
//</editor-fold>
代码示例来源:origin: fossasia/neurolab-desktop
jframe.setLocation(width - 100, 0);
jframe.setAlwaysOnTop(true);
jframe.setUndecorated(true);
jframe.setVisible(true);
代码示例来源:origin: fossasia/neurolab-desktop
jframe.setLocation(width - 100, 0);
jframe.setAlwaysOnTop(true);
jframe.setUndecorated(true);
jframe.setVisible(true);
代码示例来源:origin: RaiMan/SikuliX2
intro.setUndecorated(true);
intro.setAlwaysOnTop(true);
intro.setResizable(false);
代码示例来源:origin: RaiMan/SikuliX2
private void initBox() {
box = new JFrame();
box.setUndecorated(true);
box.setResizable(false);
box.setAlwaysOnTop(!log.isGlobalLevel(SXLog.TRACE));
代码示例来源:origin: RaiMan/SikuliX2
frame.setUndecorated(true);
frame.setAlwaysOnTop(true);
代码示例来源:origin: RaiMan/SikuliX2
@Override
public void run() {
frame.setUndecorated(true);
frame.setAlwaysOnTop(true);
代码示例来源:origin: i2p/i2p.i2p
frame.setUndecorated(true);
frame.setMinimumSize(new Dimension(0, 0));
frame.setSize(0, 0);
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame("My Frame");
frame.setExtendedState(getExtendedState()|JFrame.MAXIMIZED_BOTH);
frame.setResizable(false);
frame.setUndecorated(true);
frame.pack(); // Important line!!!
frame.setVisible(true);
System.out.println("--------> "+getContentPane().getWidth());
代码示例来源:origin: stackoverflow.com
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source instanceof JButton) {
JButton button = (button) source;
JFrame ancestorWin = (JFrame) SwingUtilities.getAncestorWindow(button);
ancestorWin.setUndecorated(!isFullScreen);
ancestorWin.setResizable(isFullScreen);
// etc...
代码示例来源:origin: stackoverflow.com
Component c; // the component you would like to print to a BufferedImage
JFrame frame = new JFrame();
frame.setBackground(Color.WHITE);
frame.setUndecorated(true);
frame.getContentPane().add(c);
frame.pack();
BufferedImage bi = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = bi.createGraphics();
c.print(graphics);
graphics.dispose();
frame.dispose();
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setShape(new RoundRectangle2D.Double(10, 10, 100, 100, 50, 50));
frame.setSize(300, 200);
frame.setVisible(true);
内容来源于网络,如有侵权,请联系作者删除!