Java Code Examples for javax.swing.border.EmptyBorder

The following are top voted examples for showing how to use javax.swing.border.EmptyBorder. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: avengers-db   File: AvengersFrame.java   Source Code and License 7 votes vote down vote up
/**
 * Create the frame.
 */
public AvengersFrame() throws Exception {
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	setBounds(100, 100, 1200, 800);
	heroPanel = new HeroInfo();
	heroPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
	//heroPanel.setLayout(new BorderLayout(0, 0));
	setContentPane(heroPanel);
	HeroService service = new HeroService();
	heroPanel.addHero(service.findHeroesByName("Captain America"));
	heroPanel.getBtnSearch().addMouseListener(new MouseAdapter() {
		@Override
		public void mouseClicked(MouseEvent e) {
			HeroInfo pan = new HeroInfo();
			pan.setBorder(new EmptyBorder(5, 5, 5, 5));
			setContentPane(pan);
			//pan.addHero(service.findHeroesByName(heroPanel.getTextField_1().toString()));
		}
	});
}
 
Example 2
Project: Library-app   File: Busqueda.java   Source Code and License 6 votes vote down vote up
public Busqueda(Connection conn, JFrameJTable principal, String sql, char QuienEs) {
	setIconImage(Toolkit.getDefaultToolkit().getImage(Busqueda.class.getResource("/biblioteca/images/book.png")));
	this.QuienEs=QuienEs;
	this.conn=conn;
	this.principal=principal;
	this.principal.setEnabled(false);
	setTitle("B�squeda");
	
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 492, 370);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	txtUsuario = new JTextField();
	txtUsuario.setBounds(10, 33, 328, 23);
	contentPane.add(txtUsuario);
	txtUsuario.setColumns(10);
	txtUsuario.addKeyListener(this);
	
	btnBuscar = new JButton("Buscar");
	btnBuscar.setBounds(357, 32, 109, 23);
	contentPane.add(btnBuscar);
	btnBuscar.addActionListener(this);
	
	table = new PanelJtable(conn,sql,this);
	table.setBounds(10, 78, 456, 242);
	contentPane.add(table);
	
	addWindowListener(this);
	setVisible(true);
	setLocationRelativeTo(null);
}
 
Example 3
Project: QN-ACTR-Release   File: AllStationsParametersPanel.java   Source Code and License 6 votes vote down vote up
private void initComponents() {
	setLayout(new BorderLayout(5, 5));
	this.setBorder(new EmptyBorder(20, 20, 20, 20));
	//classesList = new JList(new StationsListModel());
	stationsList = new JList();
	stationsList.setListData(stationData.getStationKeys());
	stationsList.setCellRenderer(new StationElementRenderer());
	stationsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	panelDescription = new JLabel(STATIONS_PAR_DESCRIPTION);
	JScrollPane jsp = new JScrollPane(stationsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	jsp.setPreferredSize(new Dimension(140, 200));
	add(panelDescription, BorderLayout.NORTH);
	add(jsp, BorderLayout.WEST);
	stationsList.addListSelectionListener(new ListSelectionListener() {
		public void valueChanged(ListSelectionEvent e) {
			updateParsPane();
		}
	});
}
 
Example 4
Project: Open-DM   File: InitialImportFilePanel.java   Source Code and License 6 votes vote down vote up
private void layoutGuiComponents() {

        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        setBorder(new EmptyBorder(25, 25, 25, 25));

        importFileValue = new PlainFontLabel();
        JPanel labelPanel = new FixedHeightPanel();
        labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS));
        labelPanel.add(new JLabel("File:"));
        labelPanel.add(Box.createHorizontalStrut(12));
        labelPanel.add(importFileValue);
        labelPanel.add(Box.createHorizontalGlue());

        displayArea = new JTextArea();
        displayArea.setEditable(false);
        displayArea.setForeground(Color.GRAY);
        JScrollPane scrollPane = new JScrollPane(displayArea);

        //
        // top level panel
        //
        add(labelPanel);
        add(Box.createVerticalStrut(17));
        add(scrollPane);
    }
 
Example 5
Project: incubator-netbeans   File: VariablesViewButtons.java   Source Code and License 6 votes vote down vote up
private static JToggleButton createToggleButton (final String id, String iconPath, String tooltip) {
    Icon icon = ImageUtilities.loadImageIcon(iconPath, false);
    boolean isSelected = isButtonSelected(id);
    final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
    // ensure small size, just for the icon
    Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
    toggleButton.setPreferredSize(size);
    toggleButton.setMargin(new Insets(1, 1, 1, 1));
    if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
        // We do not want an ugly border with the exception of Mac, where it paints the toggle state!
        toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton)));
    }
    toggleButton.setToolTipText(tooltip);
    toggleButton.setFocusable(false);
    return toggleButton;
}
 
Example 6
Project: SER316-Munich   File: StickerExpand.java   Source Code and License 6 votes vote down vote up
void jbInit() throws Exception {
	border1 =
			BorderFactory.createCompoundBorder(
					BorderFactory.createEtchedBorder(
							Color.white,
							new Color(156, 156, 158)),
							BorderFactory.createEmptyBorder(5, 5, 5, 5));
	border2 = BorderFactory.createEmptyBorder(5, 0, 5, 0);
	panel1.setLayout(borderLayout1);
	this.getContentPane().setLayout(borderLayout2);

	bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
	topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
	topPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5)));
	topPanel.setBackground(Color.WHITE);

	jPanel1.setLayout(borderLayout3);
	panel1.setBorder(border1);
	jPanel1.setBorder(border2);

	getContentPane().add(panel1, BorderLayout.CENTER);
	panel1.add(jScrollPane1, BorderLayout.CENTER);
	jScrollPane1.getViewport().add(stickerText, null);
	panel1.add(jPanel1, BorderLayout.SOUTH);
	this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
	this.getContentPane().add(topPanel, BorderLayout.NORTH);

	stickerText.setText(txt);
	stickerText.setOpaque(true);
	stickerText.setBackground(backGroundColor);
	stickerText.setForeground(foreGroundColor);
}
 
Example 7
Project: incubator-netbeans   File: RuleEditorPanel.java   Source Code and License 6 votes vote down vote up
private void setFilterVisible(boolean visible) {
    northWestPanel.removeAll();
    if(visible) {
        //update the UI
        northWestPanel.add(filterTextField, BorderLayout.CENTER);
        cancelFilterLabel.setBorder(new EmptyBorder(0,4,0,0));
        if(addPropertyMode) {
            northWestPanel.add(cancelFilterLabel, BorderLayout.WEST);
        }
        //set the filter text to the node
        node.setFilterText(filterTextField.getText());

        filterTextField.requestFocus();
    } else {
        //update the UI
        northWestPanel.add(titleLabel);
        
        //just remove the filter text from the node, but keep it in the field
        //so next time it is opened it will contain the old value
        node.setFilterText(null);
    }
    northWestPanel.revalidate();
    northWestPanel.repaint();
}
 
Example 8
Project: JITRAX   File: NewDatabaseDialog.java   Source Code and License 6 votes vote down vote up
public NewDatabaseDialog() {
	newDatabaseNameField = new JTextField();
	nextButton = new JButton("NEXT");
	newDatabaseNameField.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	
	setLayout(new BorderLayout());
	
	EmptyBorder padding = new EmptyBorder(5, 5, 5, 5);
	JPanel textFieldPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
	JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
	
	textFieldPanel.setBorder(padding);
	buttonsPanel.setBorder(padding);
	
	textFieldPanel.add(new JLabel("DB name: "));
	textFieldPanel.add(newDatabaseNameField);
	buttonsPanel.add(nextButton);
	
	add(textFieldPanel, BorderLayout.NORTH);
	add(buttonsPanel, BorderLayout.SOUTH);
	
	buildWindow();
}
 
Example 9
Project: jmonet   File: TextTool.java   Source Code and License 6 votes vote down vote up
private void addTextArea(int x, int y) {
    int left = getCanvas().getBounds().x + x;
    int top = getCanvas().getBounds().y + y;

    textArea.setVisible(true);
    textArea.setBorder(new EmptyBorder(0, 0, 0, 0));
    textArea.setText("");
    textArea.setBounds(left, top, (int)(getCanvas().getBounds().getWidth() * getCanvas().getScale()) - left, (int)(getCanvas().getBounds().getHeight() * getCanvas().getScale()) - top);
    textArea.setFont(getScaledFont());
    textArea.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            TextTool.this.mousePressed(e, new Point(0, 0));
        }
    });

    getCanvas().addComponent(textArea);
    textArea.requestFocus();
}
 
Example 10
Project: incubator-netbeans   File: RemoteRepository.java   Source Code and License 6 votes vote down vote up
public static boolean updateFor (String url) {
    boolean retval = false;
    final RemoteRepository repository = new RemoteRepository(null, url, true);
    JPanel panel = repository.getPanel();
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));
    final DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(RemoteRepositoryPanel.class, "ACSD_RepositoryPanel_Title"), //NOI18N
            true, new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }, DialogDescriptor.OK_OPTION, 
            DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(RemoteRepository.class), null);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    repository.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged (ChangeEvent e) {
            dd.setValid(repository.isValid());
        }
    });
    if (repository.isValid()) {
        dd.setValid(true);
    }
    dialog.setVisible(true);
    if (dd.getValue() == DialogDescriptor.OK_OPTION) {
        repository.activeSettingsType.store();
        retval = true;
    }
    return retval;
}
 
Example 11
Project: incubator-netbeans   File: LibrariesCustomizer.java   Source Code and License 6 votes vote down vote up
/**
 * Shows libraries customizer for given library manager.
 * @param activeLibrary if not null the activeLibrary is selected in the opened customizer
 * @return true if user pressed OK and libraries were sucessfully modified
 */
@Messages("TXT_LibrariesManager=Ant Library Manager")
public static boolean showCustomizer (Library activeLibrary, LibraryManager libraryManager) {
    org.netbeans.modules.project.libraries.ui.LibrariesCustomizer  customizer =
            new org.netbeans.modules.project.libraries.ui.LibrariesCustomizer (
                    LibrariesSupport.getLibraryStorageArea(libraryManager));
    customizer.setBorder(new EmptyBorder(12, 12, 0, 12));
    if (activeLibrary != null) {
        customizer.setSelectedLibrary (LibrariesSupport.getLibraryImplementation(activeLibrary));
    }
    DialogDescriptor descriptor = new DialogDescriptor(customizer, TXT_LibrariesManager());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
    setAccessibleDescription(dlg, customizer.getAccessibleContext().getAccessibleDescription());
    try {
        dlg.setVisible(true);
        if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
            return customizer.apply();
        } else {
            return false;
        }
    } finally {
        dlg.dispose();
    }
}
 
Example 12
Project: incubator-netbeans   File: LibrariesCustomizer.java   Source Code and License 6 votes vote down vote up
@Messages("LibrariesCustomizer.customizeLibrary.title=Customize Library")
private static boolean customizeLibrary(org.netbeans.modules.project.libraries.ui.LibrariesCustomizer customizer,
        LibraryImplementation activeLibrary) {
    customizer.hideLibrariesList();
    customizer.setBorder(new EmptyBorder(12, 8, 0, 10));
    customizer.setSelectedLibrary (activeLibrary);
    DialogDescriptor descriptor = new DialogDescriptor(customizer, LibrariesCustomizer_customizeLibrary_title());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
    setAccessibleDescription(dlg, customizer.getAccessibleContext().getAccessibleDescription());
    try {
        dlg.setVisible(true);
        if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
            customizer.apply();
            return true;
        } else {
            return false;
        }
    } finally {
        dlg.dispose();
    }
}
 
Example 13
Project: Open-DM   File: GUIHelper.java   Source Code and License 6 votes vote down vote up
private static JScrollPane getMessageScrollPane(String message) {
    JTextArea ta = new JTextArea(message);
    ta.setBorder(new EmptyBorder(0, 0, 0, 0));
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setCaretPosition(0);
    ta.setEditable(false);
    JScrollPane sp = new JScrollPane(ta);
    sp.setBorder(new EmptyBorder(5, 5, 5, 5));
    if (message.length() < 100) {
        sp.setPreferredSize(new Dimension(400, 50));
    } else {
        sp.setPreferredSize(new Dimension(400, 100));
    }
    return sp;
}
 
Example 14
Project: incubator-netbeans   File: BrowserDisplayer.java   Source Code and License 6 votes vote down vote up
/**
 * Creates a link label. A link label is a form of a JButton but without a
 * button like appearance.
 */
private void createLinkLabel() {
    setBorder(new EmptyBorder(1,1,1,1));
    setBorderPainted(false);
    setFocusPainted(false);
    setAlignmentY(getPreferredAlignmentY());
    setContentAreaFilled(false);
    setHorizontalAlignment(SwingConstants.LEFT);
    setBackground(UIManager.getColor("EditorPane.background"));
    if (textAttribs != null &&
        textAttribs.isDefined(StyleConstants.Foreground)) {
        setForeground((Color)textAttribs.getAttribute(StyleConstants.Foreground));
    } else {
        setForeground(Color.blue);
    }
    invalidate();
}
 
Example 15
Project: BassNES   File: About.java   Source Code and License 6 votes vote down vote up
/**
 * Create the frame.
 */
public About() {
	setTitle("About - BassNES");
	setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
	setBounds(100, 100, 290, 228);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JLabel lblNewLabel = new JLabel("BassNES");
	lblNewLabel.setFont(new Font("Times New Roman", Font.BOLD, 24));
	lblNewLabel.setBounds(25, 11, 128, 43);
	contentPane.add(lblNewLabel);
	
	JLabel lblNewLabel_1 = new JLabel("Version: "+ UISettings.version);
	lblNewLabel_1.setBounds(25, 51, 115, 14);
	contentPane.add(lblNewLabel_1);
	
	JLabel lblNewLabel_2 = new JLabel("�2017 J. Howe (aka TheBassist95)");
	lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
	lblNewLabel_2.setBounds(10, 65, 254, 23);
	contentPane.add(lblNewLabel_2);
}
 
Example 16
Project: incubator-netbeans   File: DirectoryChooserUI.java   Source Code and License 6 votes vote down vote up
@Override
public void installComponents(JFileChooser fc) {
    fileChooser = fc;
    
    fc.setFocusCycleRoot(true);
    fc.setBorder(new EmptyBorder(4, 10, 10, 10));
    fc.setLayout(new BorderLayout(8, 8));
    
    updateUseShellFolder();
    createCenterPanel(fc);
    fc.add(centerPanel, BorderLayout.CENTER);
    
    if (fc.isMultiSelectionEnabled()) {
        setFileName(getStringOfFileNames(fc.getSelectedFiles()));
    } else {
        setFileName(getStringOfFileName(fc.getSelectedFile()));
    }
    
    if(fc.getControlButtonsAreShown()) {
        addControlButtons();
    }
    
    createPopup();

    initUpdateWorker();
}
 
Example 17
Project: TransparentDiscord   File: UITitleBar.java   Source Code and License 6 votes vote down vote up
/**
 * Creates a title bar with the given text and ability to close the parent jframe
 * @param titleText the text to display as the title, can be HTML formatted
 * @param parent the jframe to close when the X is clicked
 */
public UITitleBar(String titleText, JFrame parent) {
    setBackground(Color.decode("#7289DA"));
    setLayout(new BorderLayout());

    JLabel title = new JLabel(titleText);
    title.setFont(TransparentDiscord.boldFont.deriveFont(Font.PLAIN, 16));
    title.setBorder(new EmptyBorder(20,20,20,20));
    add(title, BorderLayout.WEST);

    JLabel closeButton = new JLabel("X");
    closeButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent mouseEvent) {
            parent.setVisible(false);
        }
    });
    closeButton.setBorder(new EmptyBorder(20,20,20,20));
    closeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    add(closeButton, BorderLayout.EAST);
}
 
Example 18
Project: incubator-netbeans   File: OptionsPanel.java   Source Code and License 6 votes vote down vote up
void setSelected () {
    if (isMac) {
        setBorder(new CompoundBorder (
                new VariableBorder(null, selectedB, null, selectedB),
                BorderFactory.createEmptyBorder(5, 5, 3, 5)
                ));
    } else {
        setBorder (new CompoundBorder (
            new CompoundBorder (
                new LineBorder (getTabPanelBackground()),
                new LineBorder (selectedB)
            ),
            new EmptyBorder (0, 2, 0, 2)
        ));
    }
    setBackground (selected);            
}
 
Example 19
Project: incubator-netbeans   File: VariablesViewButtons.java   Source Code and License 6 votes vote down vote up
private static JToggleButton createToggleButton (final String id, String iconName, String tooltip) {
    Icon icon = loadIcon(iconName);
    boolean isSelected = isButtonSelected(id);
    final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
    // ensure small size, just for the icon
    Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
    toggleButton.setPreferredSize(size);
    toggleButton.setMargin(new Insets(1, 1, 1, 1));
    if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
        // We do not want an ugly border with the exception of Mac, where it paints the toggle state!
        toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton)));
    }
    toggleButton.setToolTipText(tooltip);
    toggleButton.setFocusable(false);
    return toggleButton;
}
 
Example 20
Project: DicomViewer   File: FlyingToolTip.java   Source Code and License 6 votes vote down vote up
public FlyingToolTip(final FlyingToolTipListener source) {
    this.source = source;
    label = new JLabel("test", JLabel.CENTER) {
        @Override
        public void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D) g.create();
            int w = getWidth(), h = getHeight();
            g.setColor(getBackground());
            g.fillRect(0,0,w,h);

            if (path != null) {                    
                g2.setStroke(new BasicStroke(4f));
                g2.setColor(getForeground());
                g2.draw(path);
            }
            setOpaque(false);
            super.paintComponent(g2);
            setOpaque(true);
            g2.dispose();
        }
    };    
    label.setBorder(new EmptyBorder(2,4,10,4));
    label.setOpaque(true);
}
 
Example 21
Project: incubator-netbeans   File: InfoPanel.java   Source Code and License 6 votes vote down vote up
Item(Color backgroundColor, int preferredHeight, JComponent innerPanel) {
    this.backgroundColor = backgroundColor;
    this.preferredHeight = preferredHeight;
    this.innerPanel = innerPanel;
    topGapPanel = createGapPanel();
    bottomGapPanel = createGapPanel();
    separator = createSeparator();
    outerPanel = new JPanel();
    outerPanel.setBackground(backgroundColor);
    outerPanel.setLayout(new BorderLayout());
    outerPanel.add(BorderLayout.NORTH, topGapPanel);
    outerPanel.add(BorderLayout.CENTER, innerPanel);
    outerPanel.add(BorderLayout.SOUTH, bottomGapPanel);
    outerPanel.setPreferredSize(new Dimension(0, preferredHeight));
    scrollPane = new JScrollPane();
    scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
    scrollPane.setPreferredSize(new Dimension(0, preferredHeight));
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setViewportView(outerPanel);
}
 
Example 22
Project: TransparentDiscord   File: UIChat.java   Source Code and License 6 votes vote down vote up
private void addAttachmentPreview(Image image) {
    ImageIcon preview = TransparentDiscord.resizeToWidth(new ImageIcon(image), TransparentDiscord.getChatWidth()-10);
    JLabel previewLabel = new JLabel(preview);
    previewLabel.setBorder(new EmptyBorder(5,5,5,5));
    previewLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent mouseEvent) {
            BorderLayout layout = (BorderLayout) messageCompose.getLayout();
            messageCompose.remove(layout.getLayoutComponent(BorderLayout.CENTER));

            attachment = null;
            fileAttachment = null;

            refresh();
        }
    });
    previewLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    messageCompose.add(previewLabel,BorderLayout.CENTER);
    refresh();
}
 
Example 23
Project: VASSAL-src   File: WizardDisplayerImpl.java   Source Code and License 6 votes vote down vote up
void handleSummary(Summary summary)
{
    inSummary = true;
    JComponent summaryComp = (JComponent) summary.getSummaryComponent(); // XXX
    if (summaryComp.getBorder() != null)
    {
        CompoundBorder b = new CompoundBorder(new EmptyBorder(5, 5, 5, 5), summaryComp
            .getBorder());
        summaryComp.setBorder(b);
    }
    setCurrentWizardPanel(summaryComp); // XXX
    instructions.setInSummaryPage(true);
    ttlLabel.setText(NbBridge.getString("org/netbeans/api/wizard/Bundle", // NOI18N
                                        WizardDisplayerImpl.class, "Summary")); // NOI18N
    getButtonManager().setSummaryShowingMode();
    summaryComp.requestFocus();
    
}
 
Example 24
Project: AquamarineLake   File: MyFrame.java   Source Code and License 5 votes vote down vote up
/**
* Create the frame.
*/
  public MyFrame() {
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setBounds(100, 100, 650, 490);
      contentPane = new JPanel();
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      setContentPane(contentPane);
      contentPane.setLayout(null);

      new MyThread().start();
  }
 
Example 25
Project: alevin-svn2   File: MultiAlgoScenarioWizard.java   Source Code and License 5 votes vote down vote up
@Override
protected JPanel createContent() {
	JPanel content = new JPanel();
	content.setBorder(new EmptyBorder(PADDING, PADDING, 0, PADDING));
	content.setLayout(new BorderLayout(PADDING, 0));

	// createTable enables/disables buttons, therefore createButtons must be called first
	content.add(this.createButtons(), BorderLayout.EAST);
	content.add(this.createTable(), BorderLayout.CENTER);

	return content;
}
 
Example 26
Project: featurea   File: SimulationTreePanel.java   Source Code and License 5 votes vote down vote up
/**
 * Default constructor.
 */
public SimulationTreePanel() {
    this.root = new DefaultMutableTreeNode(null, true);
    this.model = new DefaultTreeModel(this.root);
    this.tree = new JTree(this.model);
    this.tree.setCellRenderer(new Renderer());
    this.tree.setEditable(false);
    this.tree.setShowsRootHandles(true);
    this.tree.setBorder(new EmptyBorder(5, 0, 0, 0));

    // the bounds
    this.bounds = new DefaultMutableTreeNode(new NullBounds());
    this.model.insertNodeInto(this.bounds, this.root, this.root.getChildCount());
    this.tree.expandPath(new TreePath(this.bounds).getParentPath());

    // folder to contain the bodies
    this.bodyFolder = new DefaultMutableTreeNode(Messages.getString("panel.tree.bodyFolder"));
    this.model.insertNodeInto(this.bodyFolder, this.root, this.root.getChildCount());
    this.tree.expandPath(new TreePath(this.bodyFolder.getPath()).getParentPath());

    // folder to contain the joints
    this.jointFolder = new DefaultMutableTreeNode(Messages.getString("panel.tree.jointFolder"));
    this.model.insertNodeInto(this.jointFolder, this.root, this.root.getChildCount());
    this.tree.expandPath(new TreePath(this.jointFolder.getPath()).getParentPath());

    // folder to contain the rays
    this.rayFolder = new DefaultMutableTreeNode(Messages.getString("panel.tree.rayFolder"));
    this.model.insertNodeInto(this.rayFolder, this.root, this.root.getChildCount());
    this.tree.expandPath(new TreePath(this.rayFolder.getPath()).getParentPath());

    this.scroller = new JScrollPane(this.tree);
    this.scroller.setBorder(BorderFactory.createLineBorder(Color.GRAY));

    this.setLayout(new BorderLayout());
    this.add(this.scroller);

    this.tree.addMouseListener(this);

    this.createContextMenus();
}
 
Example 27
Project: java-irc   File: Channel.java   Source Code and License 5 votes vote down vote up
/**
 * Create the frame to choose the channel
 */
public Channel() {
	this.setTitle("Chat IRC");
	this.setResizable(false);
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	this.setBounds(100, 100, 460, 261);
	this.setLocationRelativeTo(null);
	setIconImage(Toolkit.getDefaultToolkit().getImage(Channel.class.getResource("/image/swag.png")));
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JButton btnOk = new JButton("OK");
	Icon imgOk = new ImageIcon(Toolkit.getDefaultToolkit().getImage(Channel.class.getResource("/image/ok.png")));
	btnOk.setIcon(imgOk);
	btnOk.setFont(new Font("Tahoma", Font.BOLD, 14));
	btnOk.addActionListener(new ChannelListener());
	btnOk.setBounds(164, 152, 104, 30);
	contentPane.add(btnOk);
	
	JLabel lblChannel = new JLabel("Channel");
	lblChannel.setHorizontalAlignment(SwingConstants.LEFT);
	lblChannel.setFont(new Font("Tahoma", Font.BOLD, 14));
	lblChannel.setBounds(187, 30, 72, 30);
	contentPane.add(lblChannel);
	
	textFieldChannel = new JTextField();
	textFieldChannel.setFont(new Font("Tahoma", Font.PLAIN, 14));
	textFieldChannel.setBounds(115, 85, 203, 30);
	contentPane.add(textFieldChannel);
	textFieldChannel.setColumns(10);
	
	this.addWindowListener( new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			closeFrame();
		}
	});
}
 
Example 28
Project: incubator-netbeans   File: BasicSearchForm.java   Source Code and License 5 votes vote down vote up
/**
 * Initialize panel for controls for text pattern options and add it to the
 * form panel.
 */
private void initContainingTextOptionsRow(boolean searchAndReplace) {

    JPanel jp = new JPanel();
    JPanel typeWithLabelPanel = new JPanel();
    typeWithLabelPanel.setLayout(new BoxLayout(typeWithLabelPanel,
            BoxLayout.LINE_AXIS));
    JLabel typeLabel = new JLabel();
    typeLabel.setLabelFor(textToFindType);
    lclz(typeLabel, "BasicSearchForm.textToFindType.label.text");   //NOI18N
    typeLabel.setBorder(new EmptyBorder(0, 10, 0, 5));
    typeWithLabelPanel.add(typeLabel);
    typeWithLabelPanel.add(textToFindType);
    if (searchAndReplace) {
        FormLayoutHelper flh = new FormLayoutHelper(jp,
                FormLayoutHelper.DEFAULT_COLUMN,
                FormLayoutHelper.DEFAULT_COLUMN);
        flh.addRow(chkCaseSensitive, chkPreserveCase);
        flh.addRow(chkWholeWords, typeWithLabelPanel);
        jp.setMaximumSize(jp.getMinimumSize());

        formPanel.addRow(new JLabel(), jp);
    } else {
        jp.setLayout(new BoxLayout(jp, BoxLayout.LINE_AXIS));
        jp.add(chkCaseSensitive);
        jp.add(chkWholeWords);
        jp.add(typeWithLabelPanel);
        formPanel.addRow(new JLabel(), jp);
    }
}
 
Example 29
Project: Tarski   File: OurTree.java   Source Code and License 5 votes vote down vote up
/** Constructs this renderer. */
public OurTreeRenderer(int fontSize) {
   super("Anything"); // This ensures that the height is calculated properly
   setFont(OurUtil.getVizFont().deriveFont((float)fontSize));
   setVerticalAlignment(JLabel.BOTTOM);
   setBorder(new EmptyBorder(0, 3, 0, 3));
   setText("Anything"); // So that we can derive the height
   height = super.getPreferredSize().height;
}
 
Example 30
Project: Equella   File: JFlatDialog.java   Source Code and License 5 votes vote down vote up
public Title(String text)
{
	setBorder(new EmptyBorder(0, 8, 0, 0));
	setOpaque(false);
	setText(text);
	setBackground(Color.BLACK);
}
 
Example 31
Project: xdman   File: ConfigDialog.java   Source Code and License 5 votes vote down vote up
Box createConnectionPanel() {
	Box box = Box.createVerticalBox();
	box.setOpaque(false);
	box.setBorder(new EmptyBorder(10, 0, 0, 10));

	Box box2 = Box.createHorizontalBox();
	box2.add(new JLabel(getString("DWN_TYM")));
	box2.add(Box.createHorizontalGlue());
	cmbTimeout = new JComboBox(new String[] { "10", "15", "20", "30", "45",
			"60", "120", "180", "240", "300" });
	cmbTimeout.setMaximumSize(cmbTimeout.getPreferredSize());
	box2.add(cmbTimeout);
	box.add(box2);
	box2.setBorder(new EmptyBorder(2, 0, 2, 0));

	Box box1 = Box.createHorizontalBox();
	box1.add(new JLabel(getString("DWN_SEG")));
	box1.add(Box.createHorizontalGlue());
	cmbConn = new JComboBox(new String[] { "1", "2", "3", "4", "5", "6",
			"7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "20",
			"24", "26", "28", "30", "32" });
	cmbConn.setMaximumSize(cmbTimeout.getPreferredSize());
	cmbConn.setPreferredSize(cmbTimeout.getPreferredSize());
	box1.add(cmbConn);
	box.add(box1);
	box1.setBorder(new EmptyBorder(2, 0, 2, 0));

	Box box3 = Box.createHorizontalBox();
	box3.add(new JLabel(getString("DWN_TCP")));
	box3.add(Box.createHorizontalGlue());
	cmbTcpW = new JComboBox(new String[] { "8", "16", "32", "64" });
	cmbTcpW.setMaximumSize(cmbTimeout.getPreferredSize());
	cmbTcpW.setPreferredSize(cmbTimeout.getPreferredSize());
	box3.add(cmbTcpW);
	box.add(box3);
	box3.setBorder(new EmptyBorder(2, 0, 2, 0));

	box.add(Box.createVerticalGlue());
	return box;
}
 
Example 32
Project: TwitchBot   File: MainView.java   Source Code and License 5 votes vote down vote up
private void managePanels() {
	this.logPanel = new JPanel();
	this.interactionPanel = new JPanel();
	this.logPanel.setPreferredSize(new Dimension(this.essentials.getFrameSize().width / 2, this.essentials.getFrameSize().height));

	this.mainRightPanel = new JPanel();
	this.rightPanel2 = new JPanel();
	this.rightPanel3 = new JPanel();
	this.rightPanel4 = new JPanel();
	this.rightPanel5 = new JPanel();
	this.rightPanel6 = new JPanel();

	this.logPanel.setLayout(new BorderLayout());
	this.logPanel.setBorder(new EmptyBorder(10, 30, 30, 30));

	this.interactionPanel.setLayout(new BorderLayout());
	this.interactionPanel.setBorder(new EmptyBorder(10, 0, 30, 30));

	this.mainRightPanel.setLayout(new BoxLayout(this.mainRightPanel, BoxLayout.Y_AXIS));
	this.mainRightPanel.setBorder(new EmptyBorder(10, 10, 10, 10));

	// rightPanel2.setBackground(Color.green);
	this.rightPanel2.setBorder(new EmptyBorder(50, 0, -90, 0));

	// rightPanel3.setBackground(Color.ORANGE);
	this.rightPanel3.setBorder(new EmptyBorder(0, 0, -140, 0));

	// rightPanel4.setBackground(Color.yellow);
	this.rightPanel4.setBorder(new EmptyBorder(50, 0, -90, 0));

	// rightPanel5.setBackground(Color.CYAN);

	// rightPanel6.setBackground(Color.black);
}
 
Example 33
Project: JITRAX   File: SelectedDatabaseViewer.java   Source Code and License 5 votes vote down vote up
public SelectedDatabaseViewer() {
	dbComboBox = new JComboBox<Database>();
	alterButton = new JButton("ALTER");
	removeButton = new JButton("DROP");
	
	setLayout(new GridLayout(NROWS, NCOLS, VGAP, HGAP));
	setBorder(new EmptyBorder(TOP_PADDING,
							LEFT_PADDING,
							BOTTOM_PADDING,
							RIGHT_PADDING));
	
	// ComboBox settings
	dbComboBox.setPreferredSize(new Dimension(COMBOBOX_WIDTH, COMBOBOX_HEIGHT));
	DefaultListCellRenderer dlcr = new DefaultListCellRenderer(); 
	dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER); 
	dbComboBox.setRenderer(dlcr);
	dbComboBox.setFocusable(false);
	
	JPanel comboBoxContainer = new JPanel();
	comboBoxContainer.add(dbComboBox);
	
	JPanel buttonsPanel = new JPanel();
	buttonsPanel.add(alterButton);
	buttonsPanel.add(removeButton);
	
	add(comboBoxContainer);
	add(buttonsPanel);
	
	setMinimumSize(new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT));
	setMaximumSize(new Dimension(MAXIMUM_WIDTH, MAXIMUM_HEIGHT));
}
 
Example 34
Project: GameOfSet   File: InfoPanel.java   Source Code and License 5 votes vote down vote up
private JLabel createSetsCountLabel() {
    JLabel label = new JLabel("Sets found: 0.");
    label.setOpaque(true);
    label.setBackground(Color.gray);
    label.setBorder(new EmptyBorder(10, 10, 10, 10));
    return label;
}
 
Example 35
Project: KSP-AGuS-Automatic-Guidance-System   File: GUI_CONSOLE.java   Source Code and License 5 votes vote down vote up
/**
 * Create the frame.
 */
public GUI_CONSOLE(String name) {
	super(name);
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 450, 300);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	contentPane.setLayout(new BorderLayout(0, 0));
	setContentPane(contentPane);
	setup();
}
 
Example 36
Project: incubator-netbeans   File: NbiTextPane.java   Source Code and License 5 votes vote down vote up
public NbiTextPane() {
    super();
    
    setOpaque(false);
    setEditable(false);
    setBorder(new EmptyBorder(0, 0, 0, 0));
    setFocusable(false);
    putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, true);
    
    if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
        //#134837
        //http://forums.java.net/jive/thread.jspa?messageID=283882
        setBackground(new Color(0, 0, 0, 0));
    }
}
 
Example 37
Project: owa-notifier   File: BorderLayoutNotification.java   Source Code and License 5 votes vote down vote up
public BorderLayoutNotification() {
	super();

	m_panel = new JPanel(new BorderLayout());
	m_panel.setBorder(new EmptyBorder(PANEL_PADDING, PANEL_PADDING, PANEL_PADDING, PANEL_PADDING));
	setPanel(m_panel);
}
 
Example 38
Project: etomica   File: ClusterViewer.java   Source Code and License 5 votes vote down vote up
private ClusterViewer(String name) {

    this.name = name;
    setTitle("Cluster Viewer: $" + name);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    mainPanel = new JPanel();
    mainPanel.setPreferredSize(new Dimension(800, 600));
    mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    mainPanel.setLayout(new BorderLayout(0, 0));
    add(mainPanel);
    pack();
  }
 
Example 39
Project: JavaGraph   File: ProgressBarDialog.java   Source Code and License 5 votes vote down vote up
private Box getPanel() {
    Box result = Box.createVerticalBox();
    result.setBorder(new EmptyBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH));
    result.add(getLabel());
    result.add(Box.createVerticalGlue());
    result.add(getBar());
    result.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
    return result;
}
 
Example 40
Project: QN-ACTR-Release   File: AllBlockingRegionsPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Initialize all components of this panel
 */
private void initComponents() {
	setLayout(new BorderLayout(5, 5));
	this.setBorder(new EmptyBorder(20, 20, 20, 20));
	// Builds upper panel
	JPanel upperPanel = new JPanel(new BorderLayout());
	JLabel description = new JLabel(BLOCKING_DESCRIPTION);
	upperPanel.add(description, BorderLayout.CENTER);

	//build upper right corner of the main panel
	JPanel upRightPanel = new JPanel(new BorderLayout());
	addRegion = new JButton("Add Region");
	addRegion.setMinimumSize(DIM_BUTTON_S);
	upRightPanel.add(addRegion, BorderLayout.CENTER);
	upperPanel.add(upRightPanel, BorderLayout.EAST);

	//build spinner panel
	JPanel spinnerPanel = new JPanel();
	JLabel spinnerDescrLabel = new JLabel("Regions:");
	regionsNumSpinner = new JSpinner();
	regionsNumSpinner.setPreferredSize(DIM_BUTTON_XS);
	spinnerPanel.add(spinnerDescrLabel);
	spinnerPanel.add(regionsNumSpinner);
	upRightPanel.add(spinnerPanel, BorderLayout.SOUTH);

	add(upperPanel, BorderLayout.NORTH);

	// Creates blocking regions list
	regions = new RegionTable();
	regions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

	JScrollPane jsp = new JScrollPane(regions, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	jsp.setPreferredSize(new Dimension(220, 200));
	add(jsp, BorderLayout.WEST);
	update();
}