Java Code Examples for javax.swing.JFrame.setUndecorated()

The following are Jave code examples for showing how to use setUndecorated() of the javax.swing.JFrame class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: rapidminer   File: SplashScreen.java   View Source Code Vote up 6 votes
public SplashScreen(Image productLogo, Properties properties) {
	this.properties = properties;
	this.productLogo = productLogo;
	this.productName = I18N.getGUIMessage("gui.splash.product_name");

	splashScreenFrame = new JFrame(properties.getProperty("name"));
	splashScreenFrame.getContentPane().add(this);
	SwingTools.setFrameIcon(splashScreenFrame);

	splashScreenFrame.setUndecorated(true);
	if (backgroundImage != null) {
		splashScreenFrame.setSize(backgroundImage.getWidth(this), backgroundImage.getHeight(this));
	} else {
		splashScreenFrame.setSize(550, 400);
	}
	splashScreenFrame.setLocationRelativeTo(null);

	animationTimer = new Timer(10, this);
	animationTimer.setRepeats(true);
	animationTimer.start();
}
 
Example 2
Project: SER316-Dresden   File: App.java   View Source Code Vote up 6 votes
/**
 * Method showSplash.
 */
private void showSplash() {
    splash = new JFrame();
    ImageIcon spl =
        new ImageIcon(App.class.getResource("/ui/splash.png"));
    JLabel l = new JLabel();
    l.setSize(400, 300);
    l.setIcon(spl);
    splash.getContentPane().add(l);
    splash.setSize(400, 300);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    splash.setLocation(
        (screenSize.width - 400) / 2,
        (screenSize.height - 300) / 2);
    splash.setUndecorated(true);
    splash.setVisible(true);
}
 
Example 3
Project: The-Mysterious-Mind-Of-Jack   File: Main.java   View Source Code Vote up 6 votes
public static void main(String[] args) {
    // Main method
    Main m = new Main(); // Create the game object
    Main.m = m;
    frame = new JFrame("Game");
    frame.setResizable(false);
    frame.setUndecorated(true);
    frame.add(m.canvas);
 
    frame.pack();
    frame.addWindowListener(m);

    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    frame.requestFocus();
    m.start();
}
 
Example 4
Project: SER316-Munich   File: App.java   View Source Code Vote up 6 votes
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel l = new JLabel();
	l.setSize(400, 300);
	l.setIcon(spl);
	splash.getContentPane().add(l);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 5
Project: SER316-Ingolstadt   File: App.java   View Source Code Vote up 6 votes
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel l = new JLabel();
	l.setSize(400, 300);
	l.setIcon(spl);
	splash.getContentPane().add(l);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 6
Project: Wilmersdorf_SER316   File: App.java   View Source Code Vote up 6 votes
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel jl = new JLabel();
	jl.setSize(400, 300);
	jl.setIcon(spl);
	splash.getContentPane().add(jl);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 7
Project: openjdk-jdk10   File: _AppMenuBarHandler.java   View Source Code Vote up 6 votes
void setDefaultMenuBar(final JMenuBar menuBar) {
    installDefaultMenuBar(menuBar);

    // scan the current frames, and see if any are foreground
    final Frame[] frames = Frame.getFrames();
    for (final Frame frame : frames) {
        if (frame.isVisible() && !isFrameMinimized(frame)) {
            return;
        }
    }

    // if we have no foreground frames, then we have to "kick" the menubar
    final JFrame pingFrame = new JFrame();
    pingFrame.getRootPane().putClientProperty("Window.alpha", Float.valueOf(0.0f));
    pingFrame.setUndecorated(true);
    pingFrame.setVisible(true);
    pingFrame.toFront();
    pingFrame.setVisible(false);
    pingFrame.dispose();
}
 
Example 8
Project: openjdk-jdk10   File: DockIconRepaint.java   View Source Code Vote up 6 votes
private static void createUI() {
    frame = new JFrame();
    frame.setUndecorated(true);
    frame.setSize(300, 300);
    frame.setLocationRelativeTo(null);
    final JDesktopPane pane = new JDesktopPane();
    final JPanel panel = new JPanel() {
        @Override
        protected void paintComponent(Graphics g) {
            g.setColor(color);
            g.fillRect(0, 0, getWidth(), getHeight());
        }
    };
    jif = new JInternalFrame();
    jif.add(panel);
    jif.setVisible(true);
    jif.setSize(300, 300);
    pane.add(jif);
    frame.add(pane);
    frame.setVisible(true);
}
 
Example 9
Project: Reinickendorf_SER316   File: App.java   View Source Code Vote up 6 votes
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel l = new JLabel();
	l.setSize(400, 300);
	l.setIcon(spl);
	splash.getContentPane().add(l);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 10
Project: Dahlem_SER316   File: App.java   View Source Code Vote up 6 votes
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel l = new JLabel();
	l.setSize(400, 300);
	l.setIcon(spl);
	splash.getContentPane().add(l);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 11
Project: SER316-Aachen   File: App.java   View Source Code Vote up 6 votes
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel l = new JLabel();
	l.setSize(400, 300);
	l.setIcon(spl);
	splash.getContentPane().add(l);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 12
Project: COE1186   File: DynamicDisplay.java   View Source Code Vote up 6 votes
public void initializeFrame(){

		// Main frame
		f = new JFrame("Dynamic Simulation Display");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setSize(DYNAMIC_FRAME_WIDTH, DYNAMIC_FRAME_HEIGHT);
		f.setUndecorated(true);
		f.setBackground(Color.BLACK);
		f.setLayout(null);
		f.setLocationRelativeTo(null);
		f.setResizable(false);
		f.add(new JLabel("test label"));

		// Add the dynamic track view panel
		f.add(dynamicTrackView);

		dynamicTrackView.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				dynamicTrackView.showArrows = !dynamicTrackView.showArrows;
				dynamicTrackView.refresh();
			}
		});
	}
 
Example 13
Project: jdk8u-jdk   File: MisplacedBorder.java   View Source Code Vote up 5 votes
@Override
public void run() {
    final JMenuBar menubar = new JMenuBar();
    menubar.add(new JMenu(""));
    menubar.add(new JMenu(""));
    final JFrame frame = new JFrame();
    frame.setUndecorated(true);
    frame.setJMenuBar(menubar);
    frame.setSize(W / 3, H / 3);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    // draw menu bar using standard order.
    final BufferedImage bi1 = step1(menubar);

    // draw menu border on top of the menu bar, nothing should be changed.
    final BufferedImage bi2 = step2(menubar);
    frame.dispose();

    for (int x = 0; x < W; ++x) {
        for (int y = 0; y < H; ++y) {
            if (bi1.getRGB(x, y) != bi2.getRGB(x, y)) {
                try {
                    ImageIO.write(bi1, "png", new File("image1.png"));
                    ImageIO.write(bi2, "png", new File("image2.png"));
                } catch (IOException e) {
                    e.printStackTrace();
                }
                throw new RuntimeException("Failed: wrong color");
            }
        }
    }
}
 
Example 14
Project: openjdk-jdk10   File: ComponentResizeTest.java   View Source Code Vote up 5 votes
private static void createAndShowGUI() {
    demoFrame = new JFrame();
    demoFrame.setSize(300, 300);
    demoFrame.setLayout(new FlowLayout());
    demoFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    demoFrame.setUndecorated(true);
    demoFrame.setBackground(new Color(0f, 0, 0, 0.1f));
    JCheckBox b = new JCheckBox("Whatever");
    demoFrame.paintAll(null);
    b.setOpaque(true);
    demoFrame.add(b);
    demoFrame.add(new JButton());
    demoFrame.setVisible(true);
}
 
Example 15
Project: openjdk-jdk10   File: MisplacedBorder.java   View Source Code Vote up 5 votes
@Override
public void run() {
    final JMenuBar menubar = new JMenuBar();
    menubar.add(new JMenu(""));
    menubar.add(new JMenu(""));
    final JFrame frame = new JFrame();
    frame.setUndecorated(true);
    frame.setJMenuBar(menubar);
    frame.setSize(W / 3, H / 3);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    // draw menu bar using standard order.
    final BufferedImage bi1 = step1(menubar);

    // draw menu border on top of the menu bar, nothing should be changed.
    final BufferedImage bi2 = step2(menubar);
    frame.dispose();

    for (int x = 0; x < W; ++x) {
        for (int y = 0; y < H; ++y) {
            if (bi1.getRGB(x, y) != bi2.getRGB(x, y)) {
                try {
                    ImageIO.write(bi1, "png", new File("image1.png"));
                    ImageIO.write(bi2, "png", new File("image2.png"));
                } catch (IOException e) {
                    e.printStackTrace();
                }
                throw new RuntimeException("Failed: wrong color");
            }
        }
    }
}
 
Example 16
Project: sbc-qsystem   File: ABoardFX.java   View Source Code Vote up 5 votes
private void initAndShowGUI() {
    JFrame w = new JFrame();
    w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    if (!QConfig.cfg().isDebug()) {
        w.setUndecorated(true);
    }
    // Create JavaFX panel.
    /* todo
    javafxPanel = new JFXPanel();
    javafxPanel.setPreferredSize(new Dimension(win_w, win_h));
    w.getContentPane().add(javafxPanel, BorderLayout.CENTER);
     * 
     */

    initFXscene();

    // Show frame.
    w.pack();
    w.setLocationRelativeTo(null);
    w.setVisible(true);
    if (QConfig.cfg().isDebug()) {
        w.setBounds(100, 100, 1024, 768);
    } else {
        w.setBounds(win_x, win_y, win_w, win_h);
        w.setAlwaysOnTop(true);
    }
}
 
Example 17
Project: iTrace-Archive   File: EyeXTracker.java   View Source Code Vote up 4 votes
protected void displayCalibrationStatus(JFrame frame) throws Exception {
	 double[] pointsNormalized = jniGetCalibration();
	 
	 if (pointsNormalized == null)
		 throw new IOException("Can't get calibration data!");
	 
	 int zeros = 0;
	 for( double ord: pointsNormalized){
		 if( ord <= 0 || ord > 1) zeros++;
	 }
	 ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
	 ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
	//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
	 
	 int itemCount = pointsNormalized.length/4;

	 for( int i=0; i < itemCount; i++ ){
		 
		points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
		points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
	 }
	 
	 Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
	 
	 for(Point2D.Double p: points){
		 if( !rect.contains(p) ) invalidpoints.add(p);
	 }
	 
	 for (int i = 0; i < pointsNormalized.length; i++) {
		 if (pointsNormalized[i] < 0.0001) {
			 pointsNormalized[i] = 0.0001;
		 } else if (pointsNormalized[i] > 0.9999) {
			 pointsNormalized[i] = 0.9999;
		 } else {
    		//do nothing
		 }
	 }
    
	 Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
	 for (int j = 0; j < itemCount; j+=2) {
		 calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
		 if(j != itemCount)
			 calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
	 }
	 JFrame calibFrame = frame;
	 CalibrationStatusDisplay calibDisplay = 
			 new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
	 
	 calibFrame.add(calibDisplay);
    calibFrame.setUndecorated(false);
    calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    calibFrame.setMinimumSize(new Dimension(600,300));
    calibFrame.setTitle("Calibration: "+new Date());
    Insets insets = calibFrame.getInsets();
   	int width = calibFrame.getSize().width-(insets.left+insets.right);
   	int height = calibFrame.getSize().height-(insets.top+insets.bottom);
   	calibDisplay.windowDimension = new Dimension(width,height);
    calibFrame.setVisible(true);
    calibFrame.toFront();
    calibDisplay.repaint();
}
 
Example 18
Project: iTrace-Archive   File: TobiiTracker.java   View Source Code Vote up 4 votes
protected void displayCalibrationStatus(JFrame frame) throws Exception {
	 double[] pointsNormalized = jniGetCalibration();
	 
	 if (pointsNormalized == null)
		 throw new IOException("Can't get calibration data!");
	 
	 int zeros = 0;
	 for( double ord: pointsNormalized){
		 if( ord <= 0 || ord > 1) zeros++;
	 }
	 ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
	 ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
	//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
	 
	 int itemCount = pointsNormalized.length/4;

	 for( int i=0; i < itemCount; i++ ){
		 
		points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
		points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
	 }
	 
	 Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
	 
	 for(Point2D.Double p: points){
		 if( !rect.contains(p) ) invalidpoints.add(p);
	 }
	 
	 for (int i = 0; i < pointsNormalized.length; i++) {
		 if (pointsNormalized[i] < 0.0001) {
			 pointsNormalized[i] = 0.0001;
		 } else if (pointsNormalized[i] > 0.9999) {
			 pointsNormalized[i] = 0.9999;
		 } else {
    		//do nothing
		 }
	 }
    
	 Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
	 for (int j = 0; j < itemCount; j+=2) {
		 calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
		 if(j != itemCount)
			 calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
	 }
	 JFrame calibFrame = frame;
	 CalibrationStatusDisplay calibDisplay = 
			 new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
	 
	 calibFrame.add(calibDisplay);
    calibFrame.setUndecorated(false);
    calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    calibFrame.setMinimumSize(new Dimension(600,300));
    calibFrame.setTitle("Calibration: "+new Date());
    Insets insets = calibFrame.getInsets();
    int width = calibFrame.getSize().width-(insets.left+insets.right);
    int height = calibFrame.getSize().height-(insets.top+insets.bottom);
  		calibDisplay.windowDimension = new Dimension(width,height);
    calibFrame.setVisible(true);
    calibDisplay.repaint();
}