Java Code Examples for java.awt.Window#setLayout()
The following examples show how to use
java.awt.Window#setLayout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Sage.java From sagetv with Apache License 2.0 | 5 votes |
private static void splashAndLicense() { splashWindow = new Window(masterWindow); splashWindow.setLayout(new BorderLayout()); Image theImage = null; String splashImageName; if (Sage.get("ui/splash_image", null) != null) { theImage = Toolkit.getDefaultToolkit().createImage(Sage.get("ui/splash_image", null)); ImageUtils.ensureImageIsLoaded(theImage); } else { theImage = ImageUtils.fullyLoadImage(isTrueClient() ? (is64BitJVM() ? "images/splashclient64.gif" : "images/splashclient.gif") : (is64BitJVM() ? "images/splash64.gif" : "images/splash.gif" )); } ActiveImage splashImage = new ActiveImage(theImage); splashWindow.add(splashImage, "Center"); splashText = new Label(Sage.rez("Module_Init", new Object[] { "Application" }), Label.CENTER) { public void paint(Graphics g) { super.paint(g); g.setColor(Color.black); g.drawRect(0, 0, getWidth()-1, getHeight()-1); } }; splashText.setBackground(new Color(42, 103, 190)); splashText.setForeground(Color.white); splashWindow.add(splashText, "South"); Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize(); splashWindow.pack(); Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); splashWindow.setLocation(center.x - splashWindow.getWidth()/2, center.y - splashWindow.getHeight()/2); splashWindow.setVisible(true); }
Example 2
Source File: TN5250jSplashScreen.java From tn5250j with GNU General Public License v2.0 | 4 votes |
/** * Creates the Splash screen window and configures it. */ protected void initialize(ImageIcon iimage) { image = iimage.getImage(); // if no image, return if (image == null) { throw new IllegalArgumentException("Image specified is invalid."); } // System.out.println(" here in splash "); MediaTracker tracker = new MediaTracker(this); tracker.addImage(image,0); try { tracker.waitForAll(); } catch(Exception e) { System.out.println(e.getMessage()); } // create dialog window f = new Frame(); dialog = new Window(f); dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Dimension s = new Dimension(image.getWidth(this) + 2, image.getHeight(this) + 2); setSize(s); dialog.setLayout(new BorderLayout()); dialog.setSize(s); dialog.add(this,BorderLayout.CENTER); dialog.pack(); // position splash screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int x = (screen.width - s.width)/2; if (x < 0) { x = 0; } int y = (screen.height - s.height)/2; if (y < 0) { y = 0; } dialog.setLocation(x, y); dialog.validate(); }
Example 3
Source File: RPSplash.java From RipplePower with Apache License 2.0 | 4 votes |
public RPSplash(Color progressBarColour, String imageResourcePath, String buildString, Color buildTextColour, int buildLabelX, int buildLabelY, String versionNumber, Color versionTextColour, int versionLabelX, int versionLabelY, boolean autonClose, final Updateable update) { this.buildTextColour = buildTextColour; this.buildLabelX = buildLabelX; this.buildLabelY = buildLabelY; this.versionTextColour = versionTextColour; this.versionLabelX = versionLabelX; this.versionLabelY = versionLabelY; progressColour = progressBarColour; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setBackground(Color.white); gradientColour = UIRes.getBrighter(progressBarColour, 0.75); Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 11); setFont(font); fontMetrics = getFontMetrics(font); image = LImage.createImage(imageResourcePath).getBufferedImage(); if (buildString != null) { build = buildString; } if (versionNumber != null) { version = versionNumber; } Dimension size = new Dimension(image.getWidth(this), image.getHeight(this)); window = new Window(new Frame()); window.setSize(size); window.setLayout(new BorderLayout()); window.add(BorderLayout.CENTER, this); window.setLocation(UIRes.getPointToCenter(window, size)); window.validate(); window.setVisible(true); if (autonClose) { Updateable call = new Updateable() { @Override public void action(Object o) { for (; progress < 10;) { process(); try { Thread.sleep(100); } catch (InterruptedException e) { } } RPSplash.this.dispose(); if (update != null) { update.action(progress); } } }; LSystem.postThread(call); } }