Example usage for javax.swing JInternalFrame setBackground

List of usage examples for javax.swing JInternalFrame setBackground

Introduction

In this page you can find the example usage for javax.swing JInternalFrame setBackground.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.")
public void setBackground(Color bg) 

Source Link

Document

Sets the background color of this component.

Usage

From source file:MainClass.java

public MainClass() {
    super("Focus Example");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    MyPanel mypanel = new MyPanel();

    JButton button1 = new JButton("One");
    JButton button2 = new JButton("Two");
    JButton button3 = new JButton("Three");
    JButton button4 = new JButton("Four");
    JButton button5 = new MyButton("Five*");
    JButton button6 = new MyButton("Six*");
    JButton button7 = new JButton("Seven");

    mypanel.add(button2);/*from  www .jav a 2 s. c o  m*/
    mypanel.add(button3);

    JInternalFrame frame1 = new JInternalFrame("Internal Frame 1", true, true, true, true);

    frame1.setBackground(Color.lightGray);
    frame1.getContentPane().setLayout(new GridLayout(2, 3));
    frame1.setSize(300, 200);

    frame1.getContentPane().add(button1);
    frame1.getContentPane().add(mypanel);
    frame1.getContentPane().add(button4);
    frame1.getContentPane().add(button5);
    frame1.getContentPane().add(button6);
    frame1.getContentPane().add(button7);

    JDesktopPane desktop = new JDesktopPane();
    desktop.add(frame1, new Integer(1));
    desktop.setOpaque(true);

    // Now set up the user interface window.
    Container contentPane = getContentPane();
    contentPane.add(desktop, BorderLayout.CENTER);
    setSize(new Dimension(400, 300));
    frame1.setVisible(true);
    setVisible(true);
}

From source file:Main.java

public Main() {
    super("Focus Example");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    MyPanel mypanel = new MyPanel();

    JButton button1 = new JButton("One");
    JButton button2 = new JButton("Two");
    JButton button3 = new JButton("Three");
    JButton button4 = new JButton("Four");
    JButton button5 = new MyButton("Five*");
    JButton button6 = new MyButton("Six*");
    JButton button7 = new JButton("Seven");

    mypanel.add(button2);/*from   w w  w  . ja va  2  s  .  co  m*/
    mypanel.add(button3);

    JInternalFrame frame1 = new JInternalFrame("Internal Frame 1", true, true, true, true);

    frame1.setBackground(Color.lightGray);
    frame1.getContentPane().setLayout(new GridLayout(2, 3));
    frame1.setSize(300, 200);

    frame1.getContentPane().add(button1);
    frame1.getContentPane().add(mypanel);
    frame1.getContentPane().add(button4);
    frame1.getContentPane().add(button5);
    frame1.getContentPane().add(button6);
    frame1.getContentPane().add(button7);

    JDesktopPane desktop = new JDesktopPane();
    desktop.add(frame1, new Integer(1));
    desktop.setOpaque(true);

    // Now set up the user interface window.
    Container contentPane = getContentPane();
    contentPane.add(desktop, BorderLayout.CENTER);
    setSize(new Dimension(400, 300));
    frame1.setVisible(true);
    setVisible(true);
}

From source file:FocusExample.java

public FocusExample() {

    super("Focus Example");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    MyPanel mypanel = new MyPanel();

    JButton button1 = new JButton("One");
    JButton button2 = new JButton("Two");
    JButton button3 = new JButton("Three");
    JButton button4 = new JButton("Four");
    JButton button5 = new MyButton("Five*");
    JButton button6 = new MyButton("Six*");
    JButton button7 = new JButton("Seven");

    mypanel.add(button2);// www . j  a v a  2s.  com
    mypanel.add(button3);

    JInternalFrame frame1 = new JInternalFrame("Internal Frame 1", true, true, true, true);

    frame1.setBackground(Color.lightGray);
    frame1.getContentPane().setLayout(new GridLayout(2, 3));
    frame1.setSize(300, 200);

    frame1.getContentPane().add(button1);
    frame1.getContentPane().add(mypanel);
    frame1.getContentPane().add(button4);
    frame1.getContentPane().add(button5);
    frame1.getContentPane().add(button6);
    frame1.getContentPane().add(button7);

    JDesktopPane desktop = new JDesktopPane();
    desktop.add(frame1, new Integer(1));
    desktop.setOpaque(true);

    //  Now set up the user interface window.
    Container contentPane = getContentPane();
    contentPane.add(desktop, BorderLayout.CENTER);
    setSize(new Dimension(400, 300));
    frame1.setVisible(true);
    setVisible(true);
}

From source file:de.codesourcery.jasm16.ide.ui.viewcontainers.Perspective.java

@Override
public IView addView(final IView view) {
    if (view == null) {
        throw new IllegalArgumentException("view must not be NULL");
    }//  w w  w  .ja  v a  2  s.  com
    final JInternalFrame internalFrame = new JInternalFrame(view.getTitle(), true, true, true, true);

    internalFrame.setBackground(Color.BLACK);
    internalFrame.setForeground(Color.GREEN);

    internalFrame.getContentPane().add(view.getPanel(this));

    SizeAndLocation sizeAndLoc = applicationConfig.getViewCoordinates(getUniqueID(view));
    if (sizeAndLoc != null) {
        internalFrame.setSize(sizeAndLoc.getSize());
        internalFrame.setLocation(sizeAndLoc.getLocation());
    } else {
        internalFrame.setSize(200, 150);
        internalFrame.setLocation(0, 0);
        internalFrame.pack();
    }

    internalFrame.setVisible(true);

    final InternalFrameWithView frameAndView = new InternalFrameWithView(internalFrame, view);

    final InternalFrameListener listener = new InternalFrameAdapter() {

        @Override
        public void internalFrameClosing(InternalFrameEvent e) {
            disposeView(view);
        }
    };

    internalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
    internalFrame.addInternalFrameListener(listener);

    views.add(frameAndView);
    desktop.add(internalFrame);
    return view;
}