Java Code Examples for javax.swing.BorderFactory

The following are top voted examples for showing how to use javax.swing.BorderFactory. 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: incubator-netbeans   File: NotificationImpl.java   View source code 7 votes vote down vote up
private JComponent createDetails(String text, ActionListener action) {
    try {
        text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N
    } catch (CharConversionException ex) {
        throw new IllegalArgumentException(ex);
    }
    if (null == action) {
        return new JLabel(text);
    }
    JButton btn = new JButton(text);
    btn.setFocusable(false);
    btn.setBorder(BorderFactory.createEmptyBorder());
    btn.setBorderPainted(false);
    btn.setFocusPainted(false);
    btn.setOpaque(false);
    btn.setContentAreaFilled(false);
    btn.addActionListener(action);
    btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
    if (c != null) {
        btn.setForeground(c);
    }
    return btn;
}
 
Example 2
Project: xdman   File: HelpDialog.java   View source code 6 votes vote down vote up
public HelpDialog() {
	setTitle(StringResource.getString("DEFAULT_TITLE"));
	setSize(640, 480);
	htmlPane = new JEditorPane();
	JPanel panel = new JPanel(new BorderLayout(5, 5));
	panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	panel.add(new JScrollPane(htmlPane));
	add(panel);
	model = new HelpListModel();
	helpList = new JList(values);
	JPanel p = new JPanel(new BorderLayout());
	p.add(createToolBar(), BorderLayout.NORTH);
	p.add(new JScrollPane(helpList));
	panel.add(p, BorderLayout.WEST);
	setIconImage(XDMIconMap.getIcon("APP_ICON").getImage());
	helpList.addListSelectionListener(this);
	htmlPane.setEditable(false);
	map.put(keys[0], getClass().getResource(
			"/help/browser_integration.html"));
	map.put(keys[1], getClass().getResource("/help/video_download.html"));
	map.put(keys[2], getClass().getResource("/help/refresh_link.html"));
}
 
Example 3
Project: cuttlefish   File: DBExploreNode.java   View source code 6 votes vote down vote up
/**
 * This method checks if the entered distance is
 * a number, e.g., and integer greater than 0
 */
private void checkDistanceInput() {
	int distance = -1;
	distanceInputValid = false;
	try {
		if (!distanceField.getText().isEmpty())
			distance = Integer.parseInt(distanceField.getText());			
	} catch (NumberFormatException numEx) {
		System.out.println("Distance is not a number");
	}
	
	if(distance <= 0) {
		distanceInputValid = false;
		distanceField.setBorder(BorderFactory.createLineBorder(Color.red));
		distanceInfo.setText("Invalid distance");
		distanceInfo.setForeground(Color.red);
	} else {
		distanceInputValid = true;
		distanceInfo.setText("");
		distanceField.setBorder(BorderFactory.createLineBorder(Color.green));
	}
	checkOkEnabled();
}
 
Example 4
Project: QN-ACTR-Release   File: SolutionPanel.java   View source code 6 votes vote down vote up
/**
 * Set up the panel contents and layout
 */
protected void initComponents() {
	table = new ResultsTable(getTableModel(), help);

	statusLabel.setForeground(Color.red);
	statusLabel.setFont(new Font("Arial", Font.BOLD, 14));
	statusLabel.setText("WARNING: parameters have been changed since this solution was computed!");
	statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
	help.addHelp(statusLabel, "This solution is not current with the parameters of the model. Click solve to compute a new solution.");

	JPanel intPanel = new JPanel(new BorderLayout(10, 10));

	JScrollPane jsp = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
	JLabel descrLabel = new JLabel(getDescriptionMessage());

	intPanel.add(descrLabel, BorderLayout.NORTH);
	intPanel.add(jsp, BorderLayout.CENTER);

	setLayout(new BorderLayout());
	add(intPanel, BorderLayout.CENTER);
	setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

}
 
Example 5
Project: incubator-netbeans   File: HierarchyTopComponent.java   View source code 6 votes vote down vote up
MainToolBar(@NonNull final Pair<JComponent,GridBagConstraints>... components) {
    super(BoxLayout.X_AXIS);
    setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 5));
    final JToolBar toolbar = new NoBorderToolBar(JToolBar.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setBorderPainted(false);
    toolbar.setBorder(BorderFactory.createEmptyBorder());
    toolbar.setOpaque(false);
    toolbar.setFocusable(false);
    toolbar.setLayout(new GridBagLayout());
    for (Pair<JComponent,GridBagConstraints> p : components) {
        toolbar.add(p.first(),p.second());
    }
    add (toolbar);
}
 
Example 6
Project: sstore-soft   File: TableGui.java   View source code 6 votes vote down vote up
private JPanel createTableCSVArea()
{
    JPanel paneCSV = new JPanel();
    paneCSV.setLayout(new BoxLayout(paneCSV, BoxLayout.X_AXIS));
    paneCSV.setBorder(BorderFactory.createLineBorder(Color.GRAY));

    paneCSV.add(m_checkLinkCsv);
    paneCSV.add(m_txtLinkCsvPath);
    m_txtLinkCsvPath.setEditable(false);

    paneCSV.setBounds(m_scrollTblName.getWidth() + GuiConstants.GAP_COMPONENT, m_nYOffsetInRightPane,
                      s_nRightPaneWidth, s_nOneRowPaneHeight);
    m_nYOffsetInRightPane += (s_nOneRowPaneHeight + GuiConstants.GAP_COMPONENT);

    return paneCSV;
}
 
Example 7
Project: mqtt-jmeter   File: CommonConnUI.java   View source code 6 votes vote down vote up
public JPanel createConnOptions() {
	JPanel optsPanelCon = new VerticalPanel();
	optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Connection options"));
	
	JPanel optsPanel0 = new HorizontalPanel();
	optsPanel0.add(connNamePrefix);
	optsPanel0.add(connNameSuffix);
	connNameSuffix.setSelected(true);
	optsPanelCon.add(optsPanel0);
	
	JPanel optsPanel1 = new HorizontalPanel();
	optsPanel1.add(connKeepAlive);
	optsPanel1.add(connKeeptime);
	optsPanelCon.add(optsPanel1);
	
	optsPanel1.add(connAttmptMax);
	optsPanel1.add(reconnAttmptMax);
	optsPanelCon.add(optsPanel1);
	
	return optsPanelCon;
}
 
Example 8
Project: incubator-netbeans   File: GoalsPanel.java   View source code 6 votes vote down vote up
/** Creates new form POMInheritancePanel */
@Messages("HINT_Panel_hide=Click or press {0} to hide/show when the Navigator is active")
public GoalsPanel() {
    initComponents();
    treeView = (BeanTreeView)jScrollPane1;
    preferences = NbPreferences.forModule(GoalsPanel.class).node("goalNavigator");
    filtersPanel = new TapPanel();
    filtersPanel.setOrientation(TapPanel.DOWN);
    // tooltip
    KeyStroke toggleKey = KeyStroke.getKeyStroke(KeyEvent.VK_T,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    String keyText = Utilities.keyToString(toggleKey);
    filtersPanel.setToolTipText(HINT_Panel_hide(keyText)); //NOI18N

    JComponent buttons = createFilterButtons();
    buttons.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0));
    filtersPanel.add(buttons);
    if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) {
        filtersPanel.setBackground(UIManager.getColor("NbExplorerView.background"));//NOI18N
    } 

    add(filtersPanel, BorderLayout.SOUTH);
    
}
 
Example 9
Project: JITRAX   File: TablePanel.java   View source code 6 votes vote down vote up
public TablePanel(Table aTable) {
	table = aTable;
	innerPanel = new JPanel();
	
	add(innerPanel);
	
	// Adding the panel's border padding
	setLayout(new FlowLayout(FlowLayout.LEFT));
	innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
	innerPanel.setBorder(BorderFactory.createEmptyBorder(NEW_TABLE_PANEL_TOP_PADDING, 
											NEW_TABLE_PANEL_LEFT_PADDING, 
											NEW_TABLE_PANEL_BOTTOM_PADDING, 
											NEW_TABLE_PANEL_RIGHT_PADDING));
	
	// Fill the panel with the attributes info
	addAttributes();
	
	// Common settings
	setBackground(BACKGROUND_COLOR);
	innerPanel.setBackground(BACKGROUND_COLOR);
}
 
Example 10
Project: Equella   File: ExceptionDialog.java   View source code 6 votes vote down vote up
private JComponent createNiceMessages()
{
	JLabel heading = new JLabel("<html><font size=+1>" + title + "</font></html>");

	JTextArea body = new JTextArea(message);
	body.setHighlighter(null);
	body.setEditable(false);
	body.setFocusable(false);
	body.setOpaque(false);
	body.setBorder(null);
	body.setLineWrap(true);
	body.setWrapStyleWord(true);
	body.setFont(heading.getFont());

	final int[] rows = new int[]{heading.getPreferredSize().height, TableLayout.FILL};
	final int[] columns = new int[]{TableLayout.FILL};

	TableLayout layout = new TableLayout(rows, columns, 5, 5);
	JPanel all = new JPanel(layout);
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	all.add(heading, new Rectangle(0, 0, 1, 1));
	all.add(body, new Rectangle(0, 1, 1, 1));

	return all;
}
 
Example 11
Project: AgentWorkbench   File: TableCellRenderer4Color.java   View source code 6 votes vote down vote up
public Component getTableCellRendererComponent(JTable table, Object color, boolean isSelected, boolean hasFocus, int row, int column) {

    	Color newColor = (Color)color;
        setBackground(newColor);
        if (isBordered) {
            if (isSelected) {
                if (selectedBorder == null) {
                    selectedBorder = BorderFactory.createMatteBorder(2, 5, 2, 5, table.getSelectionBackground());
                }
                setBorder(selectedBorder);
            } else {
                if (unselectedBorder == null) {
                    unselectedBorder = BorderFactory.createMatteBorder(2, 5, 2, 5, table.getBackground());
                }
                setBorder(unselectedBorder);
            }
        }
        
        if(newColor!=null){
	        setToolTipText("RGB value: " + newColor.getRed() + ", " + newColor.getGreen() + ", " + newColor.getBlue());
        }
        return this;
    }
 
Example 12
Project: smile_1.5.0_java7   File: LDADemo.java   View source code 6 votes vote down vote up
/**
 * Constructor.
 */
public LDADemo() {
    startButton = new JButton("Start");
    startButton.setActionCommand("startButton");
    startButton.addActionListener(this);

    datasetBox = new JComboBox<>();
    for (int i = 0; i < datasetName.length; i++) {
        datasetBox.addItem(datasetName[i]);
    }
    datasetBox.setSelectedIndex(0);
    datasetBox.setActionCommand("datasetBox");
    datasetBox.addActionListener(this);

    optionPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
    optionPane.setBorder(BorderFactory.createRaisedBevelBorder());
    optionPane.add(startButton);
    optionPane.add(new JLabel("Dataset:"));
    optionPane.add(datasetBox);

    setLayout(new BorderLayout());
    add(optionPane, BorderLayout.NORTH);
}
 
Example 13
Project: incubator-netbeans   File: Utils.java   View source code 6 votes vote down vote up
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                                              boolean cellHasFocus) {
    JLabel renderer = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    renderer.setBorder(BorderFactory.createEmptyBorder(1, 7, 1, 5));

    if (value instanceof ProfilingPoint) {
        boolean enabled = ((ProfilingPoint) value).isEnabled();
        renderer.setText(((ProfilingPoint) value).getName());
        renderer.setIcon(enabled ? ((ProfilingPoint) value).getFactory().getIcon() :
                                   ((ProfilingPoint) value).getFactory().getDisabledIcon());
        renderer.setEnabled(enabled);
    } else if (value instanceof ProfilingPointFactory) {
        renderer.setText(((ProfilingPointFactory) value).getType());
        renderer.setIcon(((ProfilingPointFactory) value).getIcon());
        renderer.setEnabled(true);
    } else {
        renderer.setIcon(null);
        renderer.setEnabled(true);
    }

    return renderer;
}
 
Example 14
Project: incubator-netbeans   File: ResultPanelTree.java   View source code 6 votes vote down vote up
ResultPanelTree(ResultDisplayHandler displayHandler, StatisticsPanel statPanel) {
        super(new BorderLayout());
        treeView = new ResultTreeView();
        treeView.getAccessibleContext().setAccessibleName(Bundle.ACSN_TestResults());
        treeView.getAccessibleContext().setAccessibleDescription(Bundle.ACSD_TestResults());
        treeView.setBorder(BorderFactory.createEtchedBorder());
//        resultBar.setPassedPercentage(0.0f);
        JToolBar toolBar = new JToolBar();
        toolBar.setFloatable(false);
        toolBar.add(resultBar);
        toolBar.setBorder(BorderFactory.createEtchedBorder());

        add(toolBar, BorderLayout.NORTH);
        add(treeView, BorderLayout.CENTER);

        explorerManager = new ExplorerManager();
        explorerManager.setRootContext(rootNode = new RootNode(displayHandler.getSession(), filterMask));
        explorerManager.addPropertyChangeListener(this);

        initAccessibility();

        this.displayHandler = displayHandler;
        this.statPanel = statPanel;
        displayHandler.setLookup(ExplorerUtils.createLookup(explorerManager, new ActionMap()));
    }
 
Example 15
Project: smile_1.5.0_java7   File: FontChooser.java   View source code 6 votes vote down vote up
/**
 * Constructs a <code>FontChooser</code> object using the given font size array.
 * @param fontSizeStrings  the array of font size string.
 **/
public FontChooser(String[] fontSizeStrings) {
    if (fontSizeStrings == null) {
        fontSizeStrings = DEFAULT_FONT_SIZE_STRINGS;
    }
    this.fontSizeStrings = fontSizeStrings;

    JPanel selectPanel = new JPanel();
    selectPanel.setLayout(new BoxLayout(selectPanel, BoxLayout.X_AXIS));
    selectPanel.add(getFontFamilyPanel());
    selectPanel.add(getFontStylePanel());
    selectPanel.add(getFontSizePanel());

    JPanel contentsPanel = new JPanel();
    contentsPanel.setLayout(new GridLayout(2, 1));
    contentsPanel.add(selectPanel, BorderLayout.NORTH);
    contentsPanel.add(getSamplePanel(), BorderLayout.CENTER);

    this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    this.add(contentsPanel);
    this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    this.setSelectedFont(DEFAULT_SELECTED_FONT);
}
 
Example 16
Project: AgentWorkbench   File: TableCellEditor4Domains.java   View source code 6 votes vote down vote up
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {

	Component editComponent = null;
	
	this.domainVector = ctsDialog.getDomainVector();
	this.domainName = (String) value;
	if (this.domainName!=null && this.domainName.equals(GeneralGraphSettings4MAS.DEFAULT_DOMAIN_SETTINGS_NAME)==true) {
		JLabel jLabel = new JLabel(this.domainName);
		editComponent = jLabel;
		
	} else {
		JTextField jTextField = new JTextField(this.domainName);
        jTextField.setBorder(BorderFactory.createEmptyBorder());
        jTextField.getDocument().addDocumentListener(this.getTextFieldDocumentListener());
        editComponent = jTextField;
        
	}
	return editComponent;
}
 
Example 17
Project: jmt   File: Convex2DGraph.java   View source code 5 votes vote down vote up
/**
 * Initialize the object from the vector where all the points are sored
 * 
 * @param mainWin
 * 
 * @param allDominants
 *            The vector with all the points
 * @param height
 *            The height of the window
 * @param width
 *            The width of the window
 */
public Convex2DGraph(JabaModel data, JabaWizard mainWin) {
	super();
	DPoint p;

	this.setBorder(BorderFactory.createEtchedBorder());
	this.setBackground(BGCOLOR);

	addMouseListener(this);
	addMouseMotionListener(this);

	this.mainWin = mainWin;
	this.data = data;
	this.mouseButtonPress = 0;
	this.selectedPoint = null;
	this.selectedConvexSegment = null;
	this.dragging = false;
	this.dragPoint = new Point(0, 0);
	this.xMaxValue = 0;
	this.yMaxValue = 0;
	this.showAllLabels = true;
	this.filterStationLabel = new boolean[data.getStations()];
	for (int i = 0; i < data.getStations(); i++) {
		this.filterStationLabel[i] = false;
	}

	for (int i = 0; i < data.getResults().getAllDominants().size(); i++) {
		p = (DPoint) data.getResults().getAllDominants().get(i);
		if (p.getX() > xMaxValue) {
			xMaxValue = p.getX();
		}

		if (p.getY() > yMaxValue) {
			yMaxValue = p.getY();
		}
	}

}
 
Example 18
Project: Fodder-OOM_Project   File: LoginPage.java   View source code 5 votes vote down vote up
private void usernameMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_usernameMouseClicked
    // TODO add your handling code here:
    Color borderColor = new Color(101,43,215);
    if(username1.getText().equals("Username"))
    username1.setText("");
    username1.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, borderColor));
    username1.setForeground(borderColor);
}
 
Example 19
Project: the-one-mdonnyk   File: NodeChooser.java   View source code 5 votes vote down vote up
/**
 * Initializes the node chooser panels
 */
private void init() {
	nodesPanel = new JPanel();
	chooserPanel = new JPanel();
	
	this.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.anchor = GridBagConstraints.FIRST_LINE_START;
	
	nodesPanel.setLayout(new BoxLayout(nodesPanel,BoxLayout.Y_AXIS));
	nodesPanel.setBorder(BorderFactory.createTitledBorder(getBorder(),
			"Nodes"));
	
	if (nodes.size() > MAX_NODE_COUNT) {
		String[] groupNames = new String[(nodes.size()-1)/MAX_NODE_COUNT+1];
		int last = 0;
		for (int i=0, n=nodes.size(); i <= (n-1) / MAX_NODE_COUNT; i++) {
			int next = MAX_NODE_COUNT * (i+1) - 1;
			if (next > n) {
				next = n-1;
			}
			groupNames[i] = (last + "..." + next);
			last = next + 1;
		}
		groupChooser = new JComboBox(groupNames);
		groupChooser.addActionListener(this);
		chooserPanel.add(groupChooser);
	}
	
	setNodes(0);
	c.gridy = 0;
	this.add(chooserPanel, c);
	c.gridy = 1;
	this.add(nodesPanel, c);
}
 
Example 20
Project: KeysPerSecond   File: Menu.java   View source code 5 votes vote down vote up
/**
 * Repaints the component border
 */
protected static final void repaint(){
	Border border = BorderFactory.createLineBorder(Main.config.customColors ? Main.config.foreground : Color.CYAN);
	menu.setBorder(border);
	configure.getPopupMenu().setBorder(border);
	general.getPopupMenu().setBorder(border);
	precision.getPopupMenu().setBorder(border);
	configcolors.getPopupMenu().setBorder(border);
	mgraph.getPopupMenu().setBorder(border);
	rate.getPopupMenu().setBorder(border);
	reset.getPopupMenu().setBorder(border);
	saveLoad.getPopupMenu().setBorder(border);
}
 
Example 21
Project: COE1186   File: MaterialButtonUI.java   View source code 5 votes vote down vote up
@Override
public void installUI (JComponent c) {
  super.installUI(c);
  AbstractButton button = (AbstractButton) c;
  button.setOpaque (false);
  button.setBorder (BorderFactory.createEmptyBorder (7, 17, 7, 17));
}
 
Example 22
Project: Luyten4Forge   File: JFontChooser.java   View source code 5 votes vote down vote up
protected JDialog createDialog(Component parent) {
	Frame frame = parent instanceof Frame ? (Frame) parent
			: (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);
	JDialog dialog = new JDialog(frame, ("Select Font"), true);

	Action okAction = new DialogOKAction(dialog);
	Action cancelAction = new DialogCancelAction(dialog);

	JButton okButton = new JButton(okAction);
	okButton.setFont(DEFAULT_FONT);
	JButton cancelButton = new JButton(cancelAction);
	cancelButton.setFont(DEFAULT_FONT);

	JPanel buttonsPanel = new JPanel();
	buttonsPanel.setLayout(new GridLayout(2, 1));
	buttonsPanel.add(okButton);
	buttonsPanel.add(cancelButton);
	buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10));

	ActionMap actionMap = buttonsPanel.getActionMap();
	actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction);
	actionMap.put(okAction.getValue(Action.DEFAULT), okAction);
	InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
	inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), cancelAction.getValue(Action.DEFAULT));
	inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT));

	JPanel dialogEastPanel = new JPanel();
	dialogEastPanel.setLayout(new BorderLayout());
	dialogEastPanel.add(buttonsPanel, BorderLayout.NORTH);

	dialog.getContentPane().add(this, BorderLayout.CENTER);
	dialog.getContentPane().add(dialogEastPanel, BorderLayout.EAST);
	dialog.pack();
	dialog.setLocationRelativeTo(frame);
	return dialog;
}
 
Example 23
Project: Equella   File: WorkflowModel.java   View source code 5 votes vote down vote up
@Override
protected void setup()
{
	editor = new JPanel(new BorderLayout(5, 0));
	editor.setAlignmentX(Component.LEFT_ALIGNMENT);
	editor.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
		BorderFactory.createEmptyBorder(2, 5, 2, 5)));

	editor.add(createTop(), BorderLayout.NORTH);
	editor.add(createButtons(), BorderLayout.EAST);
	editor.add(createCentre(), BorderLayout.CENTER);
}
 
Example 24
Project: Equella   File: CalendarDialog.java   View source code 5 votes vote down vote up
private void setup()
{
	calendar = new JCalendar();

	select = new JButton("Select Date");
	close = new JButton("Close");

	select.addActionListener(this);
	close.addActionListener(this);

	final int width1 = select.getPreferredSize().width;
	final int width2 = close.getPreferredSize().width;
	final int height = select.getPreferredSize().height;

	final int[] rows = {TableLayout.FILL, height};
	final int[] cols = {TableLayout.FILL, width1, width2};

	JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	all.add(calendar, new Rectangle(0, 0, 3, 1));
	all.add(select, new Rectangle(1, 1, 1, 1));
	all.add(close, new Rectangle(2, 1, 1, 1));

	getContentPane().add(all);
	setSize(450, 300);

	ComponentHelper.centreOnScreen(this);
}
 
Example 25
Project: VISNode   File: ProcessBrowser.java   View source code 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList<? extends Class<Process>> list, Class<Process> value, int index, boolean isSelected, boolean cellHasFocus) {
    ProcessMetadata metadata = processMetadata.get(value);
    // Title label
    JLabel label = (JLabel) defaultRenderer.getListCellRendererComponent(list, "", index, isSelected, cellHasFocus);
    label.setText(metadata.getName());
    label.setFont(new Font("Segoe UI", Font.BOLD, 12));
    // Description label
    JLabel description = new JLabel(metadata.getDescription());
    description.setForeground(description.getForeground());
    description.setBorder(BorderFactory.createEmptyBorder(1, 10, 3, 3));
    description.setFont(new Font("Segoe UI", Font.PLAIN, 10));
    if (metadata.getDescription() == null || metadata.getDescription().isEmpty()) {
        description.setText("<No description specified>");
        description.setForeground(description.getForeground().darker());
    }
    // Builds the component
    JPanel component = new JPanel();
    component.setLayout(new BorderLayout());
    component.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
    if (isSelected) {
        component.setBackground(new Color(0xEDEDED));
    } else {
        if (index % 2 == 0) {
            component.setBackground(new Color(0x555555));
        }
    }
    component.add(label);
    component.add(description, BorderLayout.SOUTH);
    component.setOpaque(true);
    component.setForeground(description.getForeground());
    return component;
}
 
Example 26
Project: VISNode   File: ImageViewerPanel.java   View source code 5 votes vote down vote up
/**
 * Builds the info panel
 *
 * @return JComponent
 */
private JComponent buildInfo() {
    JLabel info = new JLabel();
    info.setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 0));
    info.setText(String.format("%sx%s pixels     range(%s/%s)",
            image.getWidth(),
            image.getHeight(),
            image.getPixelValueRange().getLower(),
            image.getPixelValueRange().getHigher()
    ));
    return info;
}
 
Example 27
Project: VISNode   File: InputEditor.java   View source code 5 votes vote down vote up
/**
 * Creates the editor for the MultiFile input
 * 
 * @return Component
 */
private Component buildMultiFile() {
    Panel panel = new Panel();
    panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    panel.setLayout(new BorderLayout());
    Panel psup = new Panel();
    psup.setLayout(new BoxLayout(psup, BoxLayout.X_AXIS));
    psup.put(Inputs.text().enabled(false).preferredSize(100, 22).id("multiFileName"));
    psup.put(Buttons.create().focusable(false).icon(IconFactory.get().create("fa:folder-open")).onClick((evt) -> {
        FileChooserFactory.openImages().accept((filesSelected) -> {
            input = new MultiFileInput(filesSelected, 0);
            fireValueChanged();
        });
    }));
    psup.put(Buttons.create().focusable(false).icon(IconFactory.get().create("fa:chevron-down")).onClick((evt) -> {
        JPopupMenu menu = new JPopupMenu();
        for (File file : VISNode.get().getModel().getUserPreferences().getRecentInput()) {
            JMenuItem item = new JMenuItem(file.getAbsolutePath());
            item.addActionListener((e) -> {
                input = new MultiFileInput(file);
                fireValueChanged();
            });
            menu.add(item);
        }
        menu.show(evt.getComponent(), evt.getPoint().x, evt.getPoint().y);
    }));
    panel.add(psup);
    panel.add(buidSlider(), BorderLayout.SOUTH);
    SwingUtilities.invokeLater(() -> updateMultifileFields((MultiFileInput) input));
    return panel;
}
 
Example 28
Project: KernelHive   File: JTabPanel.java   View source code 5 votes vote down vote up
public TabButton() {
	final int size = 17;
	setPreferredSize(new Dimension(size, size));
	setUI(new BasicButtonUI());
	setContentAreaFilled(false);
	setFocusable(false);
	setBorder(BorderFactory.createEtchedBorder());
	setBorderPainted(false);
	addMouseListener(buttonMouseListener);
	setRolloverEnabled(true);
	addActionListener(this);
}
 
Example 29
Project: SER316-Aachen   File: StickerExpand.java   View source code 5 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 30
Project: jmt   File: ResultsWindow.java   View source code 5 votes vote down vote up
/**
 * Sets action for toolbar buttons and displays them
 * @param startAction action associated with start simulation button
 * @param pauseAction action associated with pause simulation button
 * @param stopAction action associated with stop simulation button
 */
public void addButtonActions(AbstractAction startAction, AbstractAction pauseAction, AbstractAction stopAction) {
	start.setAction(startAction);
	start.setText("");
	start.setIcon(JMTImageLoader.loadImage("Sim"));
	start.setFocusPainted(false);
	start.setContentAreaFilled(false);
	start.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
	start.setRolloverIcon(JMTImageLoader.loadImage("SimRO"));
	start.setPressedIcon(JMTImageLoader.loadImage("SimP"));
	start.setVisible(true);

	pause.setAction(pauseAction);
	pause.setText("");
	pause.setIcon(JMTImageLoader.loadImage("Pause"));
	pause.setFocusPainted(false);
	pause.setContentAreaFilled(false);
	pause.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
	pause.setRolloverIcon(JMTImageLoader.loadImage("PauseRO"));
	pause.setPressedIcon(JMTImageLoader.loadImage("PauseP"));
	pause.setVisible(true);

	stop.setAction(stopAction);
	stop.setText("");
	stop.setIcon(JMTImageLoader.loadImage("Stop"));
	stop.setFocusPainted(false);
	stop.setContentAreaFilled(false);
	stop.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
	stop.setRolloverIcon(JMTImageLoader.loadImage("StopRO"));
	stop.setPressedIcon(JMTImageLoader.loadImage("StopP"));
	stop.setVisible(true);
}
 
Example 31
Project: Fodder-OOM_Project   File: LoginPage.java   View source code 5 votes vote down vote up
private void password_registartionFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_password_registartionFocusGained
      Color borderColor = new Color(101,43,215);
        password_registartion.setText("");
        password_registartion.setEchoChar('*');
        password_registartion.setForeground(borderColor);
        password_registartion.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, borderColor));
    // TODO add your handling code here:
}
 
Example 32
Project: rapidminer   File: SVDModelCumulativePlotRenderer.java   View source code 5 votes vote down vote up
@Override
public Component getVisualizationComponent(Object renderable, IOContainer ioContainer) {
	JPanel panel = new JPanel(new BorderLayout());
	JPanel innerPanel = new JPanel(new BorderLayout());
	innerPanel.add(getPlotter(renderable).getPlotter());
	innerPanel.setBorder(BorderFactory.createMatteBorder(10, 10, 5, 5, Colors.WHITE));
	panel.add(innerPanel, BorderLayout.CENTER);

	return panel;
}
 
Example 33
Project: Reinickendorf_SER316   File: StickerExpand.java   View source code 5 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);
	PreferencesDialog.setJComponentBGandFG(this);
}
 
Example 34
Project: owa-notifier   File: ProgressBarNotification.java   View source code 5 votes vote down vote up
public ProgressBarNotification() {
	m_label = new JLabel();
	m_progress = new JProgressBar();

	this.addComponent(m_label, BorderLayout.NORTH);

	JPanel progressPanel = new JPanel(new BorderLayout());
	progressPanel.setBorder(BorderFactory.createEmptyBorder(15, 10, 15, 10));
	progressPanel.add(m_progress, BorderLayout.CENTER);
	this.addComponent(progressPanel, BorderLayout.CENTER);
}
 
Example 35
Project: incubator-netbeans   File: ListRendererPanel.java   View source code 5 votes vote down vote up
public void configure( Color foreground, Color background, boolean isSelected, boolean hasFocus, int rowHeight, int rowWidth ) {
    removeAll();
    int maxWidth = rowWidth - SelectionList.INSETS_LEFT - SelectionList.INSETS_RIGHT;
    JComponent inner = node.getComponent( foreground, background, isSelected, hasFocus, maxWidth > 0 ? maxWidth : 0);
    add( inner, BorderLayout.CENTER );

    setBackground( background );
    setForeground( foreground );

    Border border = null;
    if( hasFocus ) {
        if( isSelected ) {
            border = UIManager.getBorder( "List.focusSelectedCellHighlightBorder" ); // NOI18N
        }
        if( border == null ) {
            border = UIManager.getBorder( "List.focusCellHighlightBorder" ); // NOI18N
        }
    }
    if( null != border ) {
        border = BorderFactory.createCompoundBorder( border,
                BorderFactory.createEmptyBorder( SelectionList.INSETS_TOP, SelectionList.INSETS_LEFT,
                SelectionList.INSETS_BOTTOM, SelectionList.INSETS_RIGHT ) );
    } else {
        border = BorderFactory.createEmptyBorder( SelectionList.INSETS_TOP, SelectionList.INSETS_LEFT,
                SelectionList.INSETS_BOTTOM, SelectionList.INSETS_RIGHT );
    }

    try {
        setBorder( border );
    } catch( NullPointerException npe ) {
        //workaround for 175940
        Logger.getLogger( ListRendererPanel.class.getName() ).log( Level.INFO, "Bug #175940", npe );
    }

    RendererPanel.configureAccessibility(this, false);
}
 
Example 36
Project: jmeter-bzm-plugins   File: HTTP2RequestGui.java   View source code 5 votes vote down vote up
protected JPanel createSourceAddrPanel() {
    final JPanel sourceAddrPanel = new HorizontalPanel();
    sourceAddrPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils
            .getResString("web_testing_source_ip"))); // $NON-NLS-1$

    sourceIpType.setSelectedIndex(HTTPSamplerBase.SourceType.HOSTNAME.ordinal()); //default: IP/Hostname
    sourceAddrPanel.add(sourceIpType);

    sourceIpAddr = new JTextField();
    sourceAddrPanel.add(sourceIpAddr);
    return sourceAddrPanel;
}
 
Example 37
Project: jmeter-bzm-plugins   File: Http2DefaultsGui.java   View source code 5 votes vote down vote up
protected JPanel createOptionalTasksPanel() {
    // OPTIONAL TASKS
    final JPanel checkBoxPanel = new VerticalPanel();
    checkBoxPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils
            .getResString("optional_tasks"))); // $NON-NLS-1$

    // Use MD5
    useMD5 = new JCheckBox(JMeterUtils.getResString("response_save_as_md5")); // $NON-NLS-1$

    checkBoxPanel.add(useMD5);

    return checkBoxPanel;
}
 
Example 38
Project: incubator-netbeans   File: Logo.java   View source code 5 votes vote down vote up
/** Creates a new instance of RecentProjects */
public Logo( String img, String url ) {
    super( new BorderLayout() );
    Icon image = new ImageIcon( ImageUtilities.loadImage(img, true) );
    JLabel label = new JLabel( image );
    label.setBorder( BorderFactory.createEmptyBorder() );
    label.setOpaque( false );
    label.addMouseListener( this );
    setOpaque( false );
    add( label, BorderLayout.CENTER );
    setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
    this.url = url;
}
 
Example 39
Project: Equella   File: ProxyDetailsDialog.java   View source code 5 votes vote down vote up
private void setup()
{
	setupOverall();

	ok = new JButton("OK");
	cancel = new JButton("Cancel");

	ok.addActionListener(this);
	cancel.addActionListener(this);

	final int width1 = cancel.getPreferredSize().width;
	final int height1 = overall.getPreferredSize().height;
	final int height2 = cancel.getPreferredSize().height;
	final int[] rows = {height1, height2,};
	final int[] cols = {WINDOW_WIDTH - (width1 * 2), width1, width1,};

	JPanel all = new JPanel(new TableLayout(rows, cols));
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	all.add(overall, new Rectangle(0, 0, 3, 1));
	all.add(ok, new Rectangle(1, 1, 1, 1));
	all.add(cancel, new Rectangle(2, 1, 1, 1));

	updateButtons();

	setTitle("Proxy Settings");
	setModal(true);
	setResizable(false);
	getContentPane().add(all);
	getRootPane().setDefaultButton(ok);

	pack();
	ComponentHelper.centreOnScreen(this);
}
 
Example 40
Project: Dahlem_SER316   File: StickerExpand.java   View source code 5 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);
}