本文整理了Java中javax.swing.JWindow.setBounds()
方法的一些代码示例,展示了JWindow.setBounds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JWindow.setBounds()
方法的具体详情如下:
包路径:javax.swing.JWindow
类名称:JWindow
方法名:setBounds
暂无
代码示例来源:origin: stackoverflow.com
public class WindowTest {
public static void main(String[] args) {
JFrame frame = new JFrame();
// remove menu bar and title bar
frame.setUndecorated(true);
frame.setVisible(true);
JWindow window = new JWindow(frame); // this works
window.setBounds(0, 50, 200, 200);
window.setVisible(true);
}
}
代码示例来源:origin: stackoverflow.com
JWindow window = new JWindow();
window.getContentPane().add(
new JLabel("", new ImageIcon(new URL("http://docs.oracle.com/javase/tutorial/uiswing/examples/misc/SplashDemoProject/src/misc/images/splash.gif")), SwingConstants.CENTER));
window.setBounds(500, 150, 300, 200);
window.setVisible(true);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
window.setVisible(false);
JFrame frame = new JFrame();
frame.add(new JLabel("Welcome"));
frame.setVisible(true);
frame.setSize(300,100);
window.dispose();
代码示例来源:origin: stackoverflow.com
JWindow window = new JWindow();
JPanel jp = new JPanel();
JLabel l = new JLabel(new ImageIcon("GenericApp.png"));
jp.add(l);
window.add(jp);
window.setBounds(500, 150, 300, 200);
window.setVisible(true);
Timer timer = new Timer(5000, new ActionListener(){
void actionPerformed(ActionEvent e){
window.setVisible(false);
}
});
timer.setRepeats(false);//only do this once
timer.start();
代码示例来源:origin: stackoverflow.com
public static void showSplash(int duration) {
SplashScreen splash1 = SplashScreen.getSplashScreen();
if(splash1==null){
File file1=new File("splash.jpg");
String imgfile1=file1.getAbsolutePath();
JWindow splash = new JWindow();
JPanel content = (JPanel)splash.getContentPane();
int width = 655;
int height = 442;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screen.width-width)/2;
int y = (screen.height-height)/2;
splash.setBounds(x,y,width,height);
JLabel label = new JLabel(new ImageIcon(imgfile1));
content.add(label, BorderLayout.CENTER);
splash.setVisible(true);
// Wait a little while, maybe while loading resources
try
{
Thread.sleep(duration);
} catch (Exception e) {}
splash.setVisible(false);
}
}
代码示例来源:origin: stackoverflow.com
public Window(final JPanel panel)
{
super("Knight Quest");
//loading screen
final JWindow window = new JWindow();
window.getContentPane().add(new JLabel("Loading..."));
window.getContentPane().add(
new JLabel("", new ImageIcon(getClass().getResource("loading.gif")), SwingConstants.CENTER));
window.setBounds(600, 300, 400, 300);
window.setVisible(true);
javax.swing.Timer timer = new javax.swing.Timer(2500,
new ActionListener() {
public void actionPerformed(ActionEvent e) {
window.setVisible(false);
setLayout(new BorderLayout());
add(panel, BorderLayout.CENTER);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(600,550);
setLocation(525, 225);
setVisible(true);
}
}
);
timer.setRepeats(false);
timer.start();
}
代码示例来源:origin: google/sagetv
static void hideSplash()
{
if (splashWindow != null)
{
splashWindow.setVisible(false);
splashWindow.removeAll();
splashWindow.setBounds(0, 0, 0, 0);
splashWindow.dispose();
splashWindow = null;
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
public static void main(String args[])
{
try
{
UIManager.setLookAndFeel(new TonicLookAndFeel());
}
catch(UnsupportedLookAndFeelException e)
{
e.printStackTrace();
}
JWindow win=new JWindow();
win.getContentPane().setLayout(new FlowLayout());
win.setBounds(10, 10, 300, 300);
Icon icon=TonicLookAndFeel.getTonicIcon("open.gif");
JButton button=new JButton(icon);
button.setEnabled(false);
win.getContentPane().add(button);
win.setVisible(true);
}
}
代码示例来源:origin: stackoverflow.com
window.setBounds(30, 30, 300, 220);
window.setLocationRelativeTo(this);
window.add(new JLabel("Test JWindow", JLabel.CENTER));
代码示例来源:origin: stackoverflow.com
JWindow subFrame = new JWindow();
subFrame.setBounds(0, 0, 500, 500);
subFrame.setAlwaysOnTop(true);
subFrame.setOpacity(0.50f);
subFrame.setBackground(new Color(1.0f, 1.0f, 1.0f, 0.05f));
JButton button = new JButton("Hello");
button.setBounds(20, 180, 100, 40);
subFrame.getContentPane().setLayout(null);
subFrame.getContentPane().add(button);
subFrame.setVisible(true);
代码示例来源:origin: stackoverflow.com
public class NextLevelCounter {
JWindow window = new JWindow();
public static void main(String[] args) {
new NextLevelCounter();
}
public NextLevelCounter() {
window.getContentPane().add(new JLabel("Waiting"));
window.setBounds(0, 0, 300, 200);
window.setVisible(true);
//Create a worker that whill close itself after 5 seconds. The main thread
//is notified and will dispose itself when worker finishes
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
Thread.sleep(5000);
return null;
}
protected void done() {
window.dispose();
}
};
worker.execute();
}
}
代码示例来源:origin: fcrepo3/fcrepo
int xLoc = screenSize.width / 2 - xSize / 2;
int yLoc = screenSize.height / 2 - ySize / 2;
splashScreen.setBounds(xLoc, yLoc, xSize, ySize);
splashScreen.setVisible(true);
代码示例来源:origin: javax.help/javahelp
/**
* show the window
*/
private void showPopup() {
if (currentPopup != null &&
SwingUtilities.getAncestorOfClass(JWindow.class, invoker) ==
currentPopup.getWindow()) {
setInvoker(currentPopup.getInvoker());
}
Rectangle popupBounds = computePopupBounds(getSize());
jheditor.setPreferredSize(new Dimension(popupBounds.width,
popupBounds.height));
window.setBounds(popupBounds.x, popupBounds.y,
popupBounds.width, popupBounds.height);
window.pack();
window.show();
currentPopup = this;
}
代码示例来源:origin: com.eas.platypus/platypus-js-calendar-widget
_calendarWindow.setBounds(x, y, _calendarWindow.getWidth(),
_calendarWindow.getHeight());
_calendarWindow.setVisible(true);
内容来源于网络,如有侵权,请联系作者删除!