Java 8 JDesktopPane - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 JDesktopPane class.

This code example shows how to use the following methods:setBounds, add, setBackground, setVisible
	public void initComponents() { 
 
		setTitle("Hello World");
		setResizable(false);
		 
		panel = new JDesktopPane();
		 
		getContentPane().add( "Center", panel );
		 
		container.add(panel);
		 
		panel.setBackground(new Color(216, 229, 246));
		panel.setVisible(true);
		panel.setBounds(300, 350, 100, 120);
		 
		lbl_username = new JLabel();
		lbl_username.setText("Hello World");
		Font font = new Font("Arial", 1, 40);
		lbl_username.setFont(font);
		 

6
CodeRank
This code example shows how to use the following methods:getSize, isVisible, getHeight, getWidth
	public Rectangle check( ScreenDockWindow window, Rectangle target ){
		return validate( target, window.getTitleCenter() );
	} 
	 
	protected Rectangle validate( Rectangle destination, Point center ){
		if( desktop.isVisible() ){
			if( lastSize == null || lastSize.width == 0 || lastSize.height == 0 ){
				lastSize = desktop.getSize();
			} 
			else{ 
				if( center == null ){
					center = new Point( destination.width/2, destination.height/2 );
				} 
				 
				Rectangle result = new Rectangle( destination );
				 
				result.x = Math.max( -center.x, result.x );
				result.x = Math.min( result.x, desktop.getWidth() - center.x );
				 
				result.y = Math.max( -center.y, result.y );

6
CodeRank
This code example shows how to use the following methods:add, setBackground, setDragMode
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        int inset = 20;
        setBounds(inset, inset, screenSize.width - (inset * 2), screenSize.height - (inset * 2));
 
        JInternalFrame theAnalyseFrame = new AnalyseInternalFrame();
        desktop = new JDesktopPane();
        desktop.add(theAnalyseFrame);
        desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
        desktop.setBackground(UIManager.getColor("Panel.background"));
        setContentPane(desktop);
 
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setLayout(new BorderLayout(0, 0));
        setTitle("Husacct - Analyse Application");
        setVisible(true);
    } 
 
    public static void main(String[] args) {
        new AnalyseDebuggingFrame(); 
    } 
6
CodeRank
This code example shows how to use the following methods:add, putClientProperty, setBorder, moveToFront
    protected void makeInternalFrameLayout(boolean showNavigator, String imageFileOrUrl) {
        boolean ownDesktop = false;   // true if this class owns the desktop
        if (desktop == null) {
            setJMenuBar(makeMenuBar());
 
            desktop = new JDesktopPane();
            desktop.setBorder(BorderFactory.createEtchedBorder());
            DialogUtil.setDesktop(desktop);
            ownDesktop = true;
 
            //Make dragging faster: 
            desktop.putClientProperty("JDesktopPane.dragMode", "outline");
 
            // fill the whole screen 
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            int w = (int) (screen.width - 10),
                    h = (int) (screen.height - 10);
            Preferences.manageSize(desktop, new Dimension(w, h), getClass().getName() + ".size");
            Preferences.manageLocation(this, 0, 0);
 

5
CodeRank
This code example shows how to use the following methods:add, putClientProperty, setBorder, moveToFront
 
        // true if this class owns the desktop 
        if ( desktop == null ) {
            setJMenuBar( makeMenuBar() );
 
            desktop = new JDesktopPane();
            desktop.setBorder( BorderFactory.createEtchedBorder() );
            DialogUtil.setDesktop( desktop );
            ownDesktop = true;
 
            //Make dragging faster: 
            desktop.putClientProperty( "JDesktopPane.dragMode", "outline" );
 
            // fill the whole screen 
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            int w = (int) ( screen.width - 10 );
            int 
                h = (int) ( screen.height - 10 );
            Preferences.manageSize( desktop, new Dimension( w, h ),
                                    getClass().getName() + ".size" );

5
CodeRank
This code example shows how to use the following methods:getLocation, getHeight, getWidth
This code example shows how to use the following methods:add
    private final JInternalFrame internal;
    private Dimension size;
    private Point location;
 
    public Test6802868(JFrame frame) {
        JDesktopPane desktop = new JDesktopPane();
 
        this.frame = frame;
        this.frame.add(desktop);
 
        this.internal = new JInternalFrame(getClass().getName(), true, true, true, true);
        this.internal.setVisible(true);
 
        desktop.add(this.internal);
    } 
 
    public void firstAction() throws PropertyVetoException {
        this.internal.setMaximum(true);
    } 
 
5
CodeRank
This code example shows how to use the following methods:
 
    private static Robot robot;
    private JInternalFrame internal;
 
    public Test6325652(JFrame frame) {
        JDesktopPane desktop = new JDesktopPane();
        desktop.add(create(0));
        desktop.add(this.internal = create(1));
        frame.add(desktop);
    } 
 
    public void select() throws PropertyVetoException {
        this.internal.setSelected(true);
    } 
 
    public static void stepFirst() throws AWTException {
        robot = new Robot(); // initialize shared static field first time
        click(KeyEvent.VK_CONTROL, KeyEvent.VK_F9); // iconify internal frame
    } 
 
5
CodeRank
This code example shows how to use the following methods:add
This code example shows how to use the following methods:add, setLayer
	public JInternalDialog( JDesktopPane desktop, FlapDockStation station ){
		this.desktop = desktop;
		this.station = station;
		setLayout( new GridLayout( 1, 1 ) );
		setVisible( false );
		desktop.add( this );
		desktop.setLayer( this, JDesktopPane.MODAL_LAYER );
	} 
	 
	public Container getContentPane(){
		if( getComponentCount() == 0 ){
			return null; 
		} 
		return (Container)getComponent( 0 );
	} 
	 
	public void setContentPane( Container content ){
		removeAll();
		if( content != null ){
			add( content );
5
CodeRank
See Code Examples for Java 8 JDesktopPane Methods: