本文整理了Java中javax.swing.JFrame.setResizable()
方法的一些代码示例,展示了JFrame.setResizable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.setResizable()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:setResizable
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void run(){
JFrame frame = new JFrame("Render Display");
display = new ImageDisplay();
display.setPreferredSize(new Dimension(width, height));
frame.getContentPane().add(display);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){
stop();
}
});
frame.pack();
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setVisible(true);
}
});
代码示例来源:origin: 4thline/cling
protected MediaRendererController() {
super(new JFrame(MediaRenderer.APPNAME), new MediaRendererLogCategories());
getView().setResizable(true);
代码示例来源:origin: igniterealtime/Openfire
frame.pack();
frame.setSize(400, 300);
frame.setResizable(true);
frame.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: 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: stackoverflow.com
public static void main(String[] args) {
JFrame frame = new JFrame(GAME_TITLE);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
sGame = new Game(GAME_WIDTH, GAME_HEIGHT);
frame.add(sGame);
frame.pack();
frame.setVisible(true);
frame.setIconImage(Resources.iconimage);
}
代码示例来源:origin: stackoverflow.com
JFrame fr=new JFrame("Color demo");
fr.setBackground(Color.red); // color set to red
fr.setSize(900,200); // size changed
fr.setResizable(false); // you cant resize your window now
代码示例来源:origin: danicuestasuarez/NMapGUI
public static void main(String[] args) {
JFrame f = new NMapLoaderWindow();
f.setResizable(false);
f.setLocationRelativeTo(null);
f.setVisible(true);
}
代码示例来源:origin: com.itextpdf/itext-rups
static void initFrameDim(JFrame frame) {
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize((int) (screen.getWidth() * .90), (int) (screen.getHeight() * .90));
frame.setLocation((int) (screen.getWidth() * .05), (int) (screen.getHeight() * .05));
frame.setResizable(true);
}
代码示例来源:origin: kevin-wayne/algs4
/**
* Displays the picture in a window on the screen.
*/
public void show() {
// create the GUI for viewing the image if needed
if (frame == null) {
frame = new JFrame();
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
menuBar.add(menu);
JMenuItem menuItem1 = new JMenuItem(" Save... ");
menuItem1.addActionListener(this);
// use getMenuShortcutKeyMaskEx() in Java 10 (getMenuShortcutKeyMask() deprecated)
menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
menu.add(menuItem1);
frame.setJMenuBar(menuBar);
frame.setContentPane(getJLabel());
// f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
if (filename == null) frame.setTitle(width + "-by-" + height);
else frame.setTitle(filename);
frame.setResizable(false);
frame.pack();
frame.setVisible(true);
}
// draw
frame.repaint();
}
代码示例来源:origin: RaiMan/SikuliX2
intro = new JFrame();
intro.addKeyListener(new KeyAdapter() {
@Override
intro.setUndecorated(true);
intro.setAlwaysOnTop(true);
intro.setResizable(false);
if (!log.isGlobalLevel(log.TRACE)) {
intro.setAlwaysOnTop(true);
intro.setLocation(centered.x, centered.y);
initBox();
intro.setVisible(true);
代码示例来源:origin: games647/LambdaAttack
public MainGui(LambdaAttack botManager) {
this.botManager = botManager;
this.frame.setResizable(false);
this.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setLookAndFeel();
JPanel topPanel = setTopPane();
JScrollPane buttonPane = setButtonPane();
this.frame.add(topPanel, BorderLayout.PAGE_START);
this.frame.add(buttonPane, BorderLayout.CENTER);
this.frame.pack();
this.frame.setVisible(true);
LambdaAttack.getLogger().info("Starting program");
}
代码示例来源:origin: fossasia/neurolab-desktop
audioFeedbackFrame.setSize(defaultWidth, defaultHeight);
audioFeedbackFrame.setVisible(true);
audioFeedbackFrame.setResizable(false);
audioFeedbackFrame.addMouseMotionListener(new MouseMotionListener()
代码示例来源:origin: 4thline/cling
public MessageBoxController(Controller parentController, final ControlPoint controlPoint, final Service service) {
super(new JFrame("MessageBoxService on: " + service.getDevice().getDetails().getFriendlyName()), parentController);
this.controlPoint = controlPoint;
this.service = service;
getView().setResizable(false);
getView().pack();
代码示例来源:origin: kevin-wayne/algs4
/**
* Displays the picture in a window on the screen.
*/
public void show() {
// create the GUI for viewing the image if needed
if (frame == null) {
frame = new JFrame();
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
menuBar.add(menu);
JMenuItem menuItem1 = new JMenuItem(" Save... ");
menuItem1.addActionListener(this);
// use getMenuShortcutKeyMaskEx() in Java 10 (getMenuShortcutKeyMask() deprecated)
menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
menu.add(menuItem1);
frame.setJMenuBar(menuBar);
frame.setContentPane(getJLabel());
// f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
if (filename == null) frame.setTitle(width + "-by-" + height);
else frame.setTitle(filename);
frame.setResizable(false);
frame.pack();
frame.setVisible(true);
}
// draw
frame.repaint();
}
代码示例来源:origin: stackoverflow.com
JLabel background1 = new JLabel(new ImageIcon("/res/mariocraft_main.png"));
JFrame frame = new JFrame();
frame.add(background1);
frame.pack();
frame.setResizable(false);
frame.setVisible(true);
代码示例来源:origin: RaiMan/SikuliX2
private void initBox() {
box = new JFrame();
box.setUndecorated(true);
box.setResizable(false);
box.setAlwaysOnTop(!log.isGlobalLevel(SXLog.TRACE));
代码示例来源:origin: kevin-wayne/algs4
private static void init() {
if (frame != null) frame.setVisible(false);
frame = new JFrame();
offscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
onscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // closes all windows
frame.pack();
frame.requestFocusInWindow();
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
JFrame f = new JFrame ("SettingBackGround");
try{
f.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("Med.jpg")))));
}catch (IOException e){
System.out.println("Image Doesnt Exist");
}
f.setVisible(true);
f.setResizable(false);
f.pack();
}
代码示例来源:origin: kevin-wayne/algs4
private void init() {
if (frame != null) frame.setVisible(false);
frame = new JFrame();
offscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
onscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // closes only current window
frame.setFocusTraversalKeysEnabled(false); // to recognize VK_TAB with isKeyPressed()
frame.setTitle(name);
frame.pack();
frame.requestFocusInWindow();
frame.setVisible(true);
内容来源于网络,如有侵权,请联系作者删除!