JLabel javaHomeLabel = new JLabel("java.home=" + System.getProperty("java.home")); setLayout(new BorderLayout()); add(versionLabel, BorderLayout.PAGE_START); add(javaHomeLabel, BorderLayout.PAGE_END); JFrame frame = new JFrame("MyJavaMacOSXApp"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); MyJavaMacOSXApp newContentPane = new MyJavaMacOSXApp(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); frame.pack(); frame.setVisible(true);
constraints.fill = GridBagConstraints.BOTH; JLabel l = new JLabel("You have got 2 new Messages."); panel.add(l, constraints); constraints.gridx++; constraints.weightx = 0f; b.setOpaque(false); b.setMargin(new Insets(1, 4, 1, 4)); b.setFocusable(false); panel.add(b, constraints); dialog.setUndecorated(true); dialog.setSize(300, 100); setOpaque(true);
s.getViewport().add(m_tree); getContentPane().add(s, BorderLayout.CENTER); setVisible(true); m_borderSelectionColor = UIManager.getColor( "Tree.selectionBorderColor"); setOpaque(false);
private static void createAndShowGUI(JPanel jtop) { JFrame frame = new JFrame("GfxdTop"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent contentPane = (JComponent) frame.getContentPane(); contentPane.add(jtop, BorderLayout.CENTER); contentPane.setOpaque(true); contentPane.setBorder(new EmptyBorder(12, 12, 12, 12)); frame.setContentPane(contentPane); frame.pack(); frame.setVisible(true); }
private static void createAndShowGUI(TxPerfGraph perfPanel) { JFrame frame = perfPanel.getFrame(); // Create and set up the window. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Create and set up the content pane. JComponent contentPane = (JComponent) frame.getContentPane(); contentPane.add(perfPanel, BorderLayout.CENTER); contentPane.setOpaque(true); //content panes must be opaque contentPane.setBorder(new EmptyBorder(12, 12, 12, 12)); frame.setContentPane(contentPane); // Display the window. frame.pack(); frame.setVisible(true); }
borderPanel.setBorder( BorderFactory.createTitledBorder("BorderLayout")); borderPanel.setOpaque(true); borderPanel.setBackground(Color.WHITE); for (int i = 0; i < 5; i++) { buttons[i] = new JButton(borderConstraints[i]); borderPanel.add(buttons[i], borderConstraints[i]); flowPanel.setBorder( BorderFactory.createTitledBorder("FlowLayout")); flowPanel.setOpaque(true); flowPanel.setBackground(Color.WHITE); for (int i = 5; i < 8; i++) { buttons[i] = new JButton(Integer.toString(i)); flowPanel.add(buttons[i]); gridPanel.setBorder( BorderFactory.createTitledBorder("GridLayout")); gridPanel.setOpaque(true); gridPanel.setBackground(Color.WHITE); for (int i = 8; i < 12; i++) { gridBagPanel.setBorder( BorderFactory.createTitledBorder("GridBagLayout")); gridBagPanel.setOpaque(true); gridBagPanel.setBackground(Color.WHITE); buttons[12] = new JButton(Integer.toString(12)); cardPanel.setBorder(
public static void createGUI(){ JFrame frame = new JFrame("My Frame"); JComponent component = new Drawing(); component.setOpaque(true); frame.add(component); frame.setSize(600,400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
import java.awt.Color; import javax.swing.JPanel; public class NewClass1 extends javax.swing.JFrame { public NewClass1() { setLayout(null); JPanel panel=new JPanel(); panel.setOpaque(true); add(panel); panel.setBackground(Color.red); panel.setBounds(0,0,400,300); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewClass1().setVisible(true); } }); } }
JFrame f = new JFrame("AnimationTest"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(this); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); timer.start(); this.setOpaque(false); this.setPreferredSize(new Dimension(WIDE, HIGH)); this.addMouseListener(new MouseHandler()); Dimension d = field.getPreferredSize(); field.setBounds(e.getX(), e.getY(), d.width, d.height); add(field);
private static void createAndShowGUI() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JComponent newContentPane = new MyUI(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "MyUI"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } frame.pack(); frame.setVisible(true); }
usrNameFeild.setOpaque(false); usrNameLabel.setLabelFor(usrNameFeild); passFeild.setBorder(compundBorder); passFeild.setOpaque(false); passwordLabel.setLabelFor(passFeild); add(usrNameLabel, labCnst); add(usrNameFeild, txtCnst); add(passwordLabel, labCnst); add(passFeild, txtCnst); JFrame frame = new JFrame("Demo: LogIn Dialogue"); frame.add(new MainContainer()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);
/** * Create the GUI and show it. As with all GUI code, this must run * on the event-dispatching thread. */ private static void createAndShowGUI(GUIAlignmentProgressListener progressListener) { //Create and set up the window. JFrame frame = new JFrame("Monitor alignment process"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = progressListener; newContentPane.setOpaque(true); //content panes must be opaque newContentPane.setSize(new Dimension(400,400)); frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
public CategoryNodeRenderer() { _panel.setBackground(UIManager.getColor("Tree.textBackground")); if (_sat == null) { // Load the satellite image. String resource = "/org/apache/log4j/lf5/viewer/images/channelexplorer_satellite.gif"; URL satURL = getClass().getResource(resource); _sat = new ImageIcon(satURL); } setOpaque(false); _checkBox.setOpaque(false); _panel.setOpaque(false); // The flowlayout set to LEFT is very important so that the editor // doesn't jump around. _panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); _panel.add(_checkBox); _panel.add(this); setOpenIcon(_sat); setClosedIcon(_sat); setLeafIcon(_sat); }
for (int col = 0; col < GRID_COLS; col++) { panelGrid[row][col] = new JPanel(new GridBagLayout()); backingPanel.add(panelGrid[row][col]); redLabel.setOpaque(true); redLabel.setBackground(Color.red.brighter().brighter()); redLabel.setPreferredSize(LABEL_SIZE); panelGrid[4][3].add(redLabel); blueLabel.setOpaque(true); blueLabel.setBackground(Color.blue.brighter().brighter()); blueLabel.setPreferredSize(LABEL_SIZE); panelGrid[1][1].add(blueLabel); JFrame frame = new JFrame("DragLabelOnLayeredPane"); frame.getContentPane().add(new DragLabelOnLayeredPane()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true);
/** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("LayeredPaneDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = new LayeredPaneDemo(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
private JFrame frame = new JFrame(); label.setOpaque(true); label.setBackground(Color.RED); label.setForeground(Color.WHITE); setLayout(new FlowLayout(FlowLayout.RIGHT)); add(label); add(new MainPanel(), BorderLayout.CENTER); add(new BorderPanel(), BorderLayout.PAGE_START); setBorder(new LineBorder(Color.BLACK, 5)); frame.setUndecorated(true); frame.add(new OutsidePanel()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true);
/** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("DropDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = new DropDemo(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }