Java Code Examples for javax.swing.JPanel

The following are top voted examples for showing how to use javax.swing.JPanel. 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: VASSAL-src   File: TranslateWindow.java   Source Code and License 7 votes vote down vote up
protected void initComponents() {
  setTitle("Translate " + VASSAL.configure.ConfigureTree.getConfigureName((Configurable) target));
  JPanel mainPanel = new JPanel(new BorderLayout());
  /*
   * Place Language selector above Tree and Keys
   */
  mainPanel.add(getHeaderPanel(), BorderLayout.PAGE_START);
  mainPanel.add(buildMainPanel(), BorderLayout.CENTER);
  mainPanel.add(getButtonPanel(), BorderLayout.PAGE_END);
  add(mainPanel);
  pack();
  setLocationRelativeTo(getParent());
  setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
  addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
      cancel();
    }
  });
}
 
Example 2
Project: rapidminer   File: ChartConfigurationPanel.java   Source Code and License 7 votes vote down vote up
@Override
public void print(Graphics pg) {

	JPanel printPanel = new JPanel() {

		private static final long serialVersionUID = 7315234075649335574L;

		@Override
		public void paintComponent(Graphics g) {
			Graphics2D g2 = (Graphics2D) g;
			plotEngine.getChartPanel().print(g2);
		}
	};
	Insets insets = plotEngine.getChartPanel().getInsets();
	int w = plotEngine.getChartPanel().getWidth() - insets.left - insets.right;
	int h = plotEngine.getChartPanel().getHeight() - insets.top - insets.bottom;
	printPanel.setSize(new Dimension(w, h));

	printPanel.print(pg);
}
 
Example 3
Project: paillier   File: GUI.java   Source Code and License 7 votes vote down vote up
public Controls() {
	setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
	setBorder(new EmptyBorder(1, 1, 1, 1));
	setBackground(Color.blue);

	JPanel t = new JPanel();
	t.setBorder(new EmptyBorder(5, 5, 5, 5));
	label = new JLabel();
	label.setLayout(new BorderLayout());
	t.add(label);
	t.setSize(1185, 50);
	add(t);
	JPanel p = new JPanel();
	start = new JButton("Start");
	start.addActionListener(this);
	p.add(start);
	processVoting = new JButton("ProcessVoting");
	processVoting.addActionListener(this);
	p.add(processVoting);
	add(p);

	textArea = new JPanel();
	screen = new JTextArea(17, 100);
	screen.setLineWrap(true);
	screen.setForeground(Color.blue);// set color for font
	screen.setBackground(Color.WHITE);// set background color
	// screen.setText("\n" + "Results from encryption and decryption");
	JScrollPane scrollingArea = new JScrollPane(screen);
	scrollingArea.setSize(15, 100);
	textArea.add(scrollingArea, BorderLayout.CENTER);
	add(textArea);

}
 
Example 4
Project: SE2Project   File: VormerkUI.java   Source Code and License 6 votes vote down vote up
/**
 * Initialisiert die Elemente der Benutzungsoberfläche.
 * 
 * @param kundenauflisterPanel Das UI-Panel des Kundenauflisters.
 * @param medienauflisterPanel Das UI-Panel des Medienauflisters.
 * @param mediendetailAnzeigerPanel Das UI-Panel des Mediendetailanzeigers.
 * 
 * @require (kundenauflisterPanel != null)
 * @require (medienauflisterPanel != null)
 * @require (kundendetailAnzeigerPanel != null)
 * @require (mediendetailAnzeigerPanel != null)
 */
public VormerkUI(JPanel kundenauflisterPanel, JPanel medienauflisterPanel,
        JPanel kundendetailAnzeigerPanel, JPanel mediendetailAnzeigerPanel)
{
    assert kundenauflisterPanel != null : "Vorbedingung verletzt: (kundenauflisterPanel != null)";
    assert medienauflisterPanel != null : "Vorbedingung verletzt: (medienauflisterPanel != null)";
    assert kundendetailAnzeigerPanel != null : "Vorbedingung verletzt: (kundendetailAnzeigerPanel != null)";
    assert mediendetailAnzeigerPanel != null : "Vorbedingung verletzt: (mediendetailAnzeigerPanel != null)";

    _kundenauflisterPanel = kundenauflisterPanel;
    _medienauflisterPanel = medienauflisterPanel;
    _mediendetailAnzeigerPanel = mediendetailAnzeigerPanel;
    _kundendetailAnzeigerPanel = kundendetailAnzeigerPanel;

    erzeugeHauptPanel();
    erzeugeAuflisterPanel();
    erzeugeAusleihePanel();
}
 
Example 5
Project: ramus   File: DFDSRoleOptionsDialog.java   Source Code and License 6 votes vote down vote up
@Override
protected Component createFirstTab(JTabbedPane pane) {
    sectorRowsEditor = new SectorRowsEditor(dataPlugin, framework,
            framework.getAccessRules());
    sectorNameEditor = new SectorNameEditor(dataPlugin, framework,
            framework.getAccessRules()) {
        @Override
        protected void createReplacementPanel(JPanel ignoreMe) {
        }

        @Override
        public Stream getStream() {
            return sectorRowsEditor.getStream();
        }
    };
    sectorNameEditor.box.setVisible(false);
    sectorRowsEditor.setSectorNameEditor(sectorNameEditor);
    pane.addTab(ResourceLoader.getString("name"), sectorRowsEditor);
    return sectorNameEditor;
}
 
Example 6
Project: rapidminer   File: EULADialog.java   Source Code and License 6 votes vote down vote up
/**
 * Creates the content panel consisting of a scrollable text area to display the EULA text and a
 * check box to accept it.
 */
private JComponent makeContentPanel() {
	JPanel panel = new JPanel();
	panel.setLayout(new BorderLayout());

	// add text area with scroll pane
	panel.add(this.scrollPane, BorderLayout.CENTER);
	// scroll to tohe top of the document
	SwingUtilities.invokeLater(new Runnable() {

		@Override
		public void run() {
			scrollPane.getVerticalScrollBar().setValue(0);
		}
	});

	// add check box to enable accept button
	panel.add(this.acceptCheckBox, BorderLayout.SOUTH);

	return panel;
}
 
Example 7
Project: thornsec-core   File: FullFrame.java   Source Code and License 6 votes vote down vote up
private JPanel getOutputPanel(JTextArea area) {
	JPanel panel = getNewPanel();

	JScrollPane areapane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

	GridBagConstraints g = new GridBagConstraints();

	areapane.setViewportView(area);

	g.gridx = 0;
	g.gridy = 1;
	g.weightx = 1;
	g.weighty = 1;
	g.fill = GridBagConstraints.BOTH;
	panel.add(areapane, g);
	
	return panel;
}
 
Example 8
Project: knime-activelearning   File: ToggleButtonList.java   Source Code and License 6 votes vote down vote up
private JToggleButton addButton(final String value) {
    final int numBtns = m_buttons.size();

    if (numBtns >= (m_maxRows * m_panels.size())) {
        // create a new Panel
        final JPanel panel = new JPanel(new GridLayout(m_maxRows, 1));

        this.add(panel);

        m_panels.add(panel);
        m_lastPanel = panel;
    }
    // createButton and add this as itemListener
    final JToggleButton btn = new CustomToggleButton(value);
    btn.addActionListener(this);

    if (value.equals(ClassModel.NO_CLASS)) {
        btn.setText(m_defaultText);
    }

    m_lastPanel.add(btn); // add it to the last Panel

    m_buttons.add(btn);
    return btn;
}
 
Example 9
Project: mqtt-jmeter   File: CommonConnUI.java   Source Code and License 6 votes vote down vote up
public JPanel createConnPanel() {
	JPanel con = new HorizontalPanel();
	
	JPanel connPanel = new HorizontalPanel();
	connPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "MQTT connection"));
	connPanel.add(serverAddr);
	connPanel.add(serverPort);
	connPanel.add(mqttVersion);
	connPanel.add(connShared);
	
	JPanel timeoutPannel = new HorizontalPanel();
	timeoutPannel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Timeout"));
	timeoutPannel.add(timeout);

	con.add(connPanel);
	con.add(timeoutPannel);
	return con;
}
 
Example 10
Project: incubator-netbeans   File: GenericToolbar.java   Source Code and License 6 votes vote down vote up
public void addSeparator() {
    if (!UIUtils.isMetalLookAndFeel()) {
        super.addSeparator();
    } else {
        final JSeparator separator = new JSeparator(JSeparator.VERTICAL);
        final int WDTH = separator.getPreferredSize().width;
        final Dimension SIZE = new Dimension(new JToolBar.Separator().getSeparatorSize().width, 12);
        JPanel panel = new JPanel(null) {
            public Dimension getPreferredSize() { return SIZE; }
            public Dimension getMaximumSize() { return SIZE; }
            public Dimension getMinimumSize() { return SIZE; }

            public void doLayout() {
                int x = (getWidth() - WDTH) / 2;
                int y = (getHeight()- SIZE.height) / 2;
                separator.setBounds(x, y, WDTH, SIZE.height);
            }
        };
        panel.setOpaque(false);
        panel.add(separator);
        super.add(panel);
    }
}
 
Example 11
Project: xdman   File: YoutubeGrabberDlg.java   Source Code and License 6 votes vote down vote up
JPanel createP3() {
	p3 = new JPanel(new BorderLayout());
	model = new DefaultListModel();
	list = new JList(model);
	list.setCellRenderer(new YTListRenderer());
	p3.add(new JScrollPane(list));
	Box box = Box.createHorizontalBox();
	box.add(Box.createHorizontalGlue());
	btnDwnld = new JButton("Download");
	btnDwnld.addActionListener(this);
	btnCancel = new JButton("Close");
	btnCancel.addActionListener(this);
	box.add(btnDwnld);
	box.add(Box.createHorizontalStrut(10));
	box.add(btnCancel);
	btnCancel.setPreferredSize(btnDwnld.getPreferredSize());
	box.add(Box.createHorizontalStrut(10));
	box.add(Box.createRigidArea(new Dimension(0, 40)));
	p3.add(box, BorderLayout.SOUTH);

	box.setOpaque(true);
	box.setBackground(StaticResource.titleColor);
	return p3;
}
 
Example 12
Project: FreeCol   File: TerrainDetailPanel.java   Source Code and License 6 votes vote down vote up
private void addProduction(JPanel panel, Stream<AbstractGoods> production) {
    // Positive production only
    List<AbstractGoods> pro = transform(production, AbstractGoods::isPositive);
    String tag = null;
    switch (pro.size()) {
    case 0:
        panel.add(new JLabel(), "wrap");
        break;
    case 1:
        tag = "span";
        break;
    default:
        tag = "span, split " + pro.size();
        break;
    }
    for (AbstractGoods ag : pro) {
        panel.add(getGoodsButton(ag.getType(), ag.getAmount()), tag);
        tag = null;
    }
}
 
Example 13
Project: Equella   File: ExceptionDialog.java   Source Code and License 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 14
Project: Equella   File: KeyResourcesTab.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("nls")
private JComponent setupResultsNavigator()
{
	countLabel = new JLabel();
	firstPage = new JButton("<<");
	prevPage = new JButton("<");
	nextPage = new JButton(">");
	lastPage = new JButton(">>");

	firstPage.setEnabled(false);
	prevPage.setEnabled(false);
	nextPage.setEnabled(false);
	lastPage.setEnabled(false);

	firstPage.addActionListener(this);
	prevPage.addActionListener(this);
	nextPage.addActionListener(this);
	lastPage.addActionListener(this);

	final int width1 = firstPage.getPreferredSize().width;
	final int height = firstPage.getPreferredSize().height;
	final int[] rows = {height,};
	final int[] cols = {TableLayout.FILL, width1, width1, width1, width1,};

	JPanel all = new JPanel(new TableLayout(rows, cols));

	all.add(countLabel, new Rectangle(0, 0, 1, 1));
	all.add(firstPage, new Rectangle(1, 0, 1, 1));
	all.add(prevPage, new Rectangle(2, 0, 1, 1));
	all.add(nextPage, new Rectangle(3, 0, 1, 1));
	all.add(lastPage, new Rectangle(4, 0, 1, 1));

	return all;
}
 
Example 15
Project: GIFKR   File: GraphInterpolator.java   Source Code and License 6 votes vote down vote up
private void initializeComponents() {
	
	graphPanel = new JPanel() {
		private static final long serialVersionUID = -1105560304467720245L;
		
		@Override 
		public Dimension getPreferredSize() {
			return getGraphSize();
		}
		
		@Override 
		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			paintGraph((Graphics2D) g, graphPanel.getWidth(), graphPanel.getHeight());
		}
	};
	graphPanel.setFocusable(true);
}
 
Example 16
Project: Vanilla-Injection   File: DisplayWindow.java   Source Code and License 6 votes vote down vote up
private void updateContentPane() {
    JPanel infoPanel = new JPanel();
    infoPanel.setBackground(BACKGROUND);

    JLabel label = new JLabel("Currently running module '" + moduleName + "' on world '" + world.getName() + "'");
    label.setForeground(FOREGROUND);
    label.setBorder(new EmptyBorder(25, 25, 25, 25));
    infoPanel.add(label);

    this.setContentPane(infoPanel);
    this.revalidate();
    this.repaint();
    this.setVisible(false);
    this.pack();
    this.setVisible(true);
}
 
Example 17
Project: QN-ACTR-Release   File: EpochPanel.java   Source Code and License 6 votes vote down vote up
private void initComponents() {
	this.setLayout(new BorderLayout());
	epochs = new JSpinner(new SpinnerNumberModel(10, 10, 50, 1));
	JPanel epochOption = new JPanel(new BorderLayout());
	JPanel flowTemp = new JPanel(new FlowLayout(FlowLayout.LEFT));
	epochs.setPreferredSize(new Dimension(70, 40));
	epochs.setFont(new Font(epochs.getFont().getName(), epochs.getFont().getStyle(), epochs.getFont().getSize() + 4));
	flowTemp.add(new JLabel("<html><body><h3>Select the maximum number of epochs: </h3></body></html> "));
	flowTemp.add(epochs);
	JButton setEpoch = new JButton(this.setEpoch);
	setEpoch.setPreferredSize(new Dimension(85, 35));
	flowTemp.add(setEpoch);
	epochOption.add(flowTemp, BorderLayout.CENTER);
	//JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
	//btnPanel.add(setEpoch);
	//epochOption.add(btnPanel,BorderLayout.SOUTH);
	this.add(epochOption, BorderLayout.NORTH);
}
 
Example 18
Project: jaer   File: FiringModelMap.java   Source Code and License 6 votes vote down vote up
protected void fillPanel() {
//			removeAll();
			JPanel dummyPanel = new JPanel();
			dummyPanel.setLayout(new BorderLayout());
			dummyPanel.add(new JLabel("   "), BorderLayout.WEST);
			kernelPanel = new JPanel();
			dummyPanel.add(kernelPanel,BorderLayout.CENTER);
			kernelPanel.setLayout(new GridBagLayout());
			CollapsablePanel collapsablePanel = new CollapsablePanel("Input kernels",dummyPanel);
            for (SignalTransformationKernel stk : inputKernels) {
				ParameterBrowserPanel newPanel = new ParameterBrowserPanel(stk);
				newPanel.toggleSelection();
				kernelPanel.add(newPanel, gbcKernel);
				panels.add(newPanel);
				gbcKernel.gridy++;
				panelCounter++;
			}
            collapsablePanel.toggleSelection();
            add(collapsablePanel, gbc);
            gbc.gridy++;
	        JFrame frame = (JFrame) SwingUtilities.getRoot(this);
	        if (frame != null)
	        	frame.pack();
		}
 
Example 19
Project: Community_Tieba-Data-Analyzer   File: Util.java   Source Code and License 5 votes vote down vote up
public static void errMessage(String s){
	JFrame frame = new JFrame("Error Message");
	JLabel label = new JLabel(s);
	JPanel panel = new JPanel();
	frame.getContentPane().add(panel);
	panel.add(label);
	frame.setVisible(true);
	frame.setSize(s.length() * 7, 100);
	frame.setLocation(Config.getIns().getWindowXLocation(), Config.getIns().getWindowYLocation());
	frame.setResizable(true);
	frame.setDefaultCloseOperation(3);
}
 
Example 20
Project: Bachelor-Thesis   File: NodeChooser.java   Source Code and License 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 21
Project: JuggleMasterPro   File: FiltersJDialog.java   Source Code and License 5 votes vote down vote up
final private JPanel doAddButtons() {

		final JPanel objLjPanel = new JPanel(new GridBagLayout());
		objLjPanel.setOpaque(true);
		final ExtendedGridBagConstraints objLextendedGridBagConstraints =
																			new ExtendedGridBagConstraints(	0,
																											GridBagConstraints.RELATIVE,
																											1,
																											1,
																											GridBagConstraints.CENTER,
																											7,
																											7,
																											0,
																											0,
																											GridBagConstraints.HORIZONTAL,
																											1.0F,
																											0.0F);
		objLjPanel.add(this.objGactivateJButton, objLextendedGridBagConstraints);
		objLjPanel.add(this.objGdeactivateJButton, objLextendedGridBagConstraints);
		objLjPanel.add(this.objGclearJButton, objLextendedGridBagConstraints);
		objLjPanel.add(this.objGcloseJButton, objLextendedGridBagConstraints);
		return objLjPanel;
	}
 
Example 22
Project: cuttlefish   File: ShowLayouts.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args)
{
    JPanel jp = getGraphPanel();

    JFrame jf = new JFrame();
    jf.getContentPane().add(jp);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.pack();
    jf.setVisible(true);
}
 
Example 23
Project: the-one-mdonnyk   File: NodeChooser.java   Source Code and License 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 24
Project: incubator-netbeans   File: StringEditor.java   Source Code and License 5 votes vote down vote up
@Override
public Component getCustomEditor () {
    if (customEditor == null) {
        JTextArea textArea = new JTextArea();
        textArea.setWrapStyleWord(true);
        textArea.setLineWrap(true);
        textArea.setColumns(60);
        textArea.setRows(8);
        textArea.getDocument().addDocumentListener(this);
        textArea.getAccessibleContext().setAccessibleName(
                NbBundle.getBundle(StringEditor.class).getString("ACSN_StringEditorTextArea")); //NOI18N
        textArea.getAccessibleContext().setAccessibleDescription(
                NbBundle.getBundle(StringEditor.class).getString("ACSD_StringEditorTextArea")); //NOI18N

        JScrollPane scroll = new JScrollPane();
        scroll.setViewportView(textArea);

        JLabel htmlTipLabel = new JLabel(NbBundle.getMessage(StringEditor.class, "StringEditor.htmlTipLabel.text")); // NOI18N

        JPanel panel = new JPanel();
        GroupLayout layout = new GroupLayout(panel);
        layout.setAutoCreateGaps(true);
        panel.setLayout(layout);
        layout.setHorizontalGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup()
                    .addComponent(scroll)
                    .addComponent(htmlTipLabel))
                .addContainerGap());
        layout.setVerticalGroup(layout.createSequentialGroup()
                .addContainerGap().addComponent(scroll).addComponent(htmlTipLabel));

        customEditor = panel;
        textComp = textArea;
        htmlTipLabel.setVisible(htmlText);
    }

    textComp.setEditable(editable);
    setValueToCustomEditor();

    return customEditor;
}
 
Example 25
Project: code-sentinel   File: BaseDialogGUI.java   Source Code and License 5 votes vote down vote up
protected void createField(String label, JComponent tf1, JComponent tf2, String tooltip) {
    JLabel jl = new JLabel(label+": ");
    jl.setToolTipText(tooltip);
    tf1.setToolTipText(tooltip);
    pLabels.add(jl);
    JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p.add(tf1);
    p.add(tf2);
    pFields.add(p);
}
 
Example 26
Project: ramus   File: Preferences.java   Source Code and License 5 votes vote down vote up
private void init() {
    double[][] size = {
            {5, TableLayout.MINIMUM, 5, TableLayout.FILL},
            {5, TableLayout.MINIMUM, 5, TableLayout.MINIMUM, 5,
                    TableLayout.MINIMUM, 5, TableLayout.MINIMUM, 5}};
    this.setTitle(getString("Preferences.Title"));

    JPanel panel = new JPanel(new TableLayout(size));

    JLabel path = new JLabel(getString("Base.Location"));

    panel.add(path, "1, 1");
    panel.add(createLocationSector(), "3, 1");

    panel.add(new JLabel(getString("WebPort")), "1, 3");
    panel.add(webPort, "3, 3");

    //panel.add(new JLabel(), "1, 5");
    panel.add(canUndoRedo, "3, 5");

    //panel.add(new JLabel(), "1, 7");
    panel.add(autostart, "3, 7");

    setMainPane(panel);
    pack();
    centerDialog();
    setResizable(false);
}
 
Example 27
Project: rapidminer   File: SVDModelCumulativePlotRenderer.java   Source Code and License 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 28
Project: Equella   File: FilterList.java   Source Code and License 5 votes vote down vote up
protected JPanel createTop()
{
	filter = new JTextField();
	filter.addActionListener(this);

	button = new JButton("Search");
	button.addActionListener(this);

	JPanel all = new JPanel(new BorderLayout(5, 5));
	all.add(filter, BorderLayout.CENTER);
	all.add(button, BorderLayout.EAST);

	return all;
}
 
Example 29
Project: alevin-svn2   File: MultiAlgoScenarioWizard.java   Source Code and License 5 votes vote down vote up
/**
 * @return a {@link JPanel} with {@link JButton}s to manipulate the network
 *         table: Move up, move down, add, remove.
 */
private JPanel createButtons() {
	JPanel bpanel = new JPanel();
	bpanel.setLayout(new BoxLayout(bpanel, BoxLayout.PAGE_AXIS));

	ActionListener listener = new ButtonHandler();
	JButton[] jbuttons = new JButton[4];
	String[] buttons = {
			UP_LBL,		UP_TIP, 	UP_ACTN,
			DOWN_LBL,	DOWN_TIP,	DOWN_ACTN,
			ADD_LBL,	ADD_TIP,	ADD_ACTN,
			REMOVE_LBL,	REMOVE_TIP,	REMOVE_ACTN
	};

	for (int i = 0; i < jbuttons.length; i++) {
		JButton button = new JButton();

		button.setText(buttons[i*3]);
		button.setToolTipText(buttons[i*3+1]);
		button.setActionCommand(buttons[i*3+2]);

		button.addActionListener(listener);
		button.setMaximumSize(new Dimension(
				Short.MAX_VALUE, button.getPreferredSize().height));

		bpanel.add(button);
		jbuttons[i] = button;

		if (i != jbuttons.length - 1) {
			bpanel.add(Box.createVerticalStrut(PADDING));
		}
	}

	this.moveUp = jbuttons[0];
	this.moveDown = jbuttons[1];
	this.add = jbuttons[2];
	this.remove = jbuttons[3];

	return bpanel;
}
 
Example 30
Project: jmeter-prometheus-plugin   File: PrometheusListenerGui.java   Source Code and License 5 votes vote down vote up
protected JPanel createAssertionClassDropDown(){
	JPanel panel = new JPanel(new BorderLayout(5, 0));
	JLabel label = new JLabel("Assertion Type:");
	
	this.assertionComboBox = new JComboBox<>(availableAssertionClasses);
	
	panel.add(label, BorderLayout.WEST);
	panel.add(this.assertionComboBox, BorderLayout.CENTER);
	
	return panel;
}
 
Example 31
Project: Cognizant-Intelligent-Test-Scripter   File: ImageGallery.java   Source Code and License 5 votes vote down vote up
/**
 * clear the thumb panels to free the memory
 */
private void clearThumbs() {
    thumbPanel.removeAll();
    for (JPanel l : thumbList) {
        l = null;
    }
    thumbList.clear();
}
 
Example 32
Project: incubator-netbeans   File: JWSCustomizerPanel.java   Source Code and License 5 votes vote down vote up
private void appletParamsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_appletParamsButtonActionPerformed

    List<Map<String,String>> origProps = jwsProps.getAppletParamsProperties();
    List<Map<String,String>> props = copyList(origProps);
    TableModel appletParamsTableModel = new JWSProjectProperties.PropertiesTableModel(props, JWSProjectProperties.appletParamsSuffixes, appletParamsColumnNames);
    JPanel panel = new AppletParametersPanel((PropertiesTableModel) appletParamsTableModel, jwsProps.appletWidthDocument, jwsProps.appletHeightDocument);
    DialogDescriptor dialogDesc = new DialogDescriptor(panel, NbBundle.getMessage(JWSCustomizerPanel.class, "TITLE_AppletParameters"), true, null); //NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDesc);
    dialog.setVisible(true);
    if (dialogDesc.getValue() == DialogDescriptor.OK_OPTION) {
        jwsProps.setAppletParamsProperties(props);
    }
    dialog.dispose();

}
 
Example 33
Project: jaer   File: SampleProb.java   Source Code and License 5 votes vote down vote up
@Override
public JPanel buildControlPanel() {
	final JPanel panel = new JPanel();
	panel.setLayout(new BorderLayout());
	final JComponent c = new SampleProbControlPanel(SampleProb.this);
	c.setPreferredSize(new Dimension(1000, 800));
	panel.add(new JScrollPane(c), BorderLayout.CENTER);
	return panel;
}
 
Example 34
Project: QN-ACTR-Release   File: LDEditingWindow.java   Source Code and License 5 votes vote down vote up
/**
 * @return the button bar
 */
JPanel makeButtons() {
	JPanel res = new JPanel();
	JButton commit = new JButton(LD_COMMIT);
	help.addHelp(commit, "Closes the LD editor saving changes");
	res.add(commit);
	JButton cancel = new JButton(LD_CANCEL);
	help.addHelp(cancel, "Closes the LD editor discarding all changes");
	res.add(cancel);
	JButton help_b = new JButton(LD_HELP);
	help.addHelp(help_b, "Shows help for the LD editor");
	res.add(help_b);
	return res;
}
 
Example 35
Project: SE2Project   File: VormerkUI.java   Source Code and License 5 votes vote down vote up
/**
 * Erzeugt das Anzeige-Panel, in dem die ausgewählte Medien und der
 * ausgewählte kunde angezeigt werden.
 */
private void erzeugeAnzeigerPanel()
{
    _anzeigerPanel = new JPanel();
    _ausleihePanel.add(_anzeigerPanel, BorderLayout.CENTER);
    _anzeigerPanel.setLayout(new BorderLayout());
    setNoSize(_anzeigerPanel);
    _anzeigerPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    _anzeigerPanel.add(_mediendetailAnzeigerPanel, BorderLayout.CENTER);
    _anzeigerPanel.add(_kundendetailAnzeigerPanel, BorderLayout.NORTH);
}
 
Example 36
Project: cuttlefish   File: CuttlefishPanel.java   Source Code and License 5 votes vote down vote up
/**
 * This method initializes layoutPanel	
 * 	
 * @return javax.swing.JPanel	
 */
private JPanel getLayoutPanel() {
	if (layoutPanel == null) {
		layoutPanel = new LayoutPanel(this);	
	}
	return layoutPanel;
}
 
Example 37
Project: LogisticApp   File: CadastroFrame.java   Source Code and License 5 votes vote down vote up
private void initializeContentPane(){
	this.contentPane = new JPanel();
	this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	this.setContentPane(contentPane);
	GridBagLayout gbl_contentPane = new GridBagLayout();
	gbl_contentPane.columnWidths = new int[]{262, 0};
	gbl_contentPane.rowHeights = new int[]{72, 72, 0};
	gbl_contentPane.columnWeights = new double[]{0.0, Double.MIN_VALUE};
	gbl_contentPane.rowWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
	contentPane.setLayout(gbl_contentPane);
}
 
Example 38
Project: TsrPlugin   File: TsrPlugin.java   Source Code and License 5 votes vote down vote up
@Override
public SettingsTab getSettingsTab() {              
    SettingsTab st = new SettingsTab() {            
        
        @Override
        public JPanel createSettingsPanel() {                
            ret = new Config();
            String urlMessage = mLocalizer.msg( "urlMessage" ,"TVStreamRecord URL and Port (e.g. http://0.0.0.0:8030)" );
            String url = mSettings.getProperty("URL");
            ret.setLabel(urlMessage);
            ret.setURL(url);
            return ret;
        }

        @Override
        public void saveSettings() {
            if (ret!=null) {
                mSettings.setProperty("URL", ret.getURL());                
            }
        }

        @Override
        public Icon getIcon() {
            ImageIcon icon = createImageIcon("img/tvstreamrecord.png");
            return icon;
        }

        @Override
        public String getTitle() {
            return "TvStreamRecord plugin";
        }
    }; 
    return st;
}
 
Example 39
Project: ZXSprite   File: ZXSpriteFrame.java   Source Code and License 5 votes vote down vote up
private JPanel createOptionPanel() {
  JPanel p = new JPanel(new FlowLayout());
  JLabel widthLabel = new JLabel("Width");
  JLabel heightLabel = new JLabel("Height");
  JLabel framesLabel = new JLabel("Num Frames");
  p.add(widthLabel);
  p.add(width);
  p.add(heightLabel);
  p.add(height);
  p.add(framesLabel);
  p.add(frames);
  return p;
}
 
Example 40
Project: smile_1.5.0_java7   File: PCADemo.java   Source Code and License 5 votes vote down vote up
@Override
public JComponent learn() {
    double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
    String[] names = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
    if (names[0] == null) {
        names = null;
    }
    boolean cor = corBox.getSelectedIndex() != 0;

    long clock = System.currentTimeMillis();
    PCA pca = new PCA(data, cor);
    System.out.format("Learn PCA from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);

    JPanel pane = new JPanel(new GridLayout(1, 2));
    PlotCanvas scree = PlotCanvas.screeplot(pca);
    scree.setTitle("Variance");
    pane.add(scree);

    pca.setProjection(3);
    double[][] y = pca.project(data);

    PlotCanvas plot = new PlotCanvas(Math.colMin(y), Math.colMax(y));
    if (names != null) {
        plot.points(y, names);
    } else if (dataset[datasetIndex].responseAttribute() != null) {
        int[] labels = dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
        for (int i = 0; i < y.length; i++) {
            plot.point(pointLegend, Palette.COLORS[labels[i]], y[i]);
        }
    } else {
        plot.points(y, pointLegend);
    }

    plot.setTitle("Scatter Plot");
    pane.add(plot);
    return pane;
}
 
Example 41
Project: OpenJSharp   File: FileChooserDemo.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("LeakingThisInConstructor")
WizardDialog(JFrame frame, boolean modal) {
    super(frame, "Embedded JFileChooser Demo", modal);

    cardLayout = new CardLayout();
    cardPanel = new JPanel(cardLayout);
    getContentPane().add(cardPanel, BorderLayout.CENTER);

    messageLabel = new JLabel("", JLabel.CENTER);
    cardPanel.add(chooser, "fileChooser");
    cardPanel.add(messageLabel, "label");
    cardLayout.show(cardPanel, "fileChooser");
    chooser.addActionListener(this);

    JPanel buttonPanel = new JPanel();
    backButton = new JButton("< Back");
    nextButton = new JButton("Next >");
    closeButton = new JButton("Close");

    buttonPanel.add(backButton);
    buttonPanel.add(nextButton);
    buttonPanel.add(closeButton);

    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    backButton.setEnabled(false);
    getRootPane().setDefaultButton(nextButton);

    backButton.addActionListener(this);
    nextButton.addActionListener(this);
    closeButton.addActionListener(this);

    pack();
    setLocationRelativeTo(frame);
}
 
Example 42
Project: fuck_zookeeper   File: NodeViewerMetaData.java   Source Code and License 5 votes vote down vote up
/**
* 
*/
  public NodeViewerMetaData() {
      this.setLayout(new BorderLayout());
      this.metaDataPanel = new JPanel();
      this.metaDataPanel.setBackground(Color.WHITE);
      JScrollPane scroller = new JScrollPane(this.metaDataPanel);
      this.add(scroller, BorderLayout.CENTER);
  }
 
Example 43
Project: SE2017-Team1   File: CRGVlib.java   Source Code and License 5 votes vote down vote up
public JPanel draw(ConresGraph graph) throws MalformedGraphException {
	if (!isValidRelations(graph)) {
		throw new MalformedGraphException("Activities to be connected are too close together!");
	}
	
	if (!isWellDefinedRelations(graph)) {
		throw new MalformedGraphException("Relations are not well defined!");
	}
	
	return new CRPanel(graph);
}
 
Example 44
Project: openjdk-jdk10   File: FileChooserDemo.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("LeakingThisInConstructor")
WizardDialog(JFrame frame, boolean modal) {
    super(frame, "Embedded JFileChooser Demo", modal);

    cardLayout = new CardLayout();
    cardPanel = new JPanel(cardLayout);
    getContentPane().add(cardPanel, BorderLayout.CENTER);

    messageLabel = new JLabel("", JLabel.CENTER);
    cardPanel.add(chooser, "fileChooser");
    cardPanel.add(messageLabel, "label");
    cardLayout.show(cardPanel, "fileChooser");
    chooser.addActionListener(this);

    JPanel buttonPanel = new JPanel();
    backButton = new JButton("< Back");
    nextButton = new JButton("Next >");
    closeButton = new JButton("Close");

    buttonPanel.add(backButton);
    buttonPanel.add(nextButton);
    buttonPanel.add(closeButton);

    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    backButton.setEnabled(false);
    getRootPane().setDefaultButton(nextButton);

    backButton.addActionListener(this);
    nextButton.addActionListener(this);
    closeButton.addActionListener(this);

    pack();
    setLocationRelativeTo(frame);
}
 
Example 45
Project: VISNode   File: NodeView.java   Source Code and License 5 votes vote down vote up
/**
 * Builds a separator for the node parâmetros
 *
 * @return JComponent
 */
private JComponent buildSeparator() {
    JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
    separator.setBorder(new EmptyBorder(0, 0, 0, 25));
    separator.setForeground(new Color(0xAAAAAA));
    separator.setBackground(new Color(0xAAAAAA));
    JPanel container = new JPanel(new BorderLayout());
    container.setBorder(new EmptyBorder(0, 10, 0, 10));
    container.add(separator);
    container.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    container.setOpaque(false);
    return container;
}
 
Example 46
Project: rapidminer   File: ComboBoxUI.java   Source Code and License 5 votes vote down vote up
@Override
public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) {
	ListCellRenderer renderer = this.comboBox.getRenderer();
	Component c;

	if (hasFocus && !isPopupVisible(this.comboBox)) {
		c = renderer.getListCellRendererComponent(this.listBox, this.comboBox.getSelectedItem(), -1, true, false);
	} else {
		c = renderer.getListCellRendererComponent(this.listBox, this.comboBox.getSelectedItem(), -1, false, false);
		c.setBackground(UIManager.getColor("ComboBox.background"));
	}
	c.setFont(this.comboBox.getFont());

	if (this.comboBox.isEnabled()) {
		c.setForeground(this.comboBox.getForeground());
		c.setBackground(this.comboBox.getBackground());
	} else {
		c.setForeground(UIManager.getColor("ComboBox.disabledForeground"));
		c.setBackground(UIManager.getColor("ComboBox.disabledBackground"));
	}

	boolean shouldValidate = false;
	if (c instanceof JPanel) {
		shouldValidate = true;
	}

	if (Boolean.parseBoolean(String.valueOf(comboBox.getClientProperty(RapidLookTools.PROPERTY_INPUT_BACKGROUND_DARK)))) {
		c.setBackground(Colors.COMBOBOX_BACKGROUND_DARK);
	} else {
		c.setBackground(Colors.COMBOBOX_BACKGROUND);
	}

	this.currentValuePane.paintComponent(g, c, this.comboBox, bounds.x, bounds.y, bounds.width, bounds.height,
			shouldValidate);
}
 
Example 47
Project: java-course   File: PrimDemo.java   Source Code and License 5 votes vote down vote up
/**
 * Initializes GUI.
 */
private void initGUI() {
    PrimListModel model = new PrimListModel();
    JList<Integer> firstList = new JList<Integer>(model);
    JList<Integer> secondList = new JList<Integer>(model);
    JButton next = new JButton("Next");

    firstList
            .setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    firstList.setLayoutOrientation(JList.VERTICAL);
    JScrollPane firstScroller = new JScrollPane(firstList);

    secondList
            .setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    secondList.setLayoutOrientation(JList.VERTICAL);
    JScrollPane secondSroller = new JScrollPane(secondList);

    next.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            model.next();
            revalidate();
        }
    });

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
    panel.add(firstScroller);
    panel.add(secondSroller);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(panel, BorderLayout.CENTER);
    getContentPane().add(next, BorderLayout.PAGE_END);
}
 
Example 48
Project: incubator-netbeans   File: BasicReplaceResultsPanel.java   Source Code and License 5 votes vote down vote up
private void init() {
    JPanel leftPanel = new JPanel();
    replaceButton = new JButton();
    replaceButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            replace();
        }
    });
    updateReplaceButton();
    leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS));
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.LEADING, 2, 1));
    buttonPanel.add(replaceButton);
    replaceButton.setMaximumSize(replaceButton.getPreferredSize());
    buttonPanel.setMaximumSize(new Dimension( // #225246
            (int) buttonPanel.getMaximumSize().getWidth(),
            (int) buttonPanel.getPreferredSize().getHeight()));
    leftPanel.add(resultsOutlineSupport.getOutlineView());
    leftPanel.add(buttonPanel);

    this.splitPane = new JSplitPane();
    splitPane.setLeftComponent(leftPanel);
    splitPane.setRightComponent(new ContextView(resultModel,
            getExplorerManager()));
    initSplitDividerLocationHandling();

    getContentPanel().add(splitPane);
    initResultModelListener();
    replaceButton.getAccessibleContext().setAccessibleDescription(
            NbBundle.getMessage(ResultView.class,
            "ACS_TEXT_BUTTON_REPLACE"));                            //NOI18N
}
 
Example 49
Project: freecol   File: StatisticsPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Creates the statistics panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param serverStatistics A map of key,value pairs of server statistics.
 * @param clientStatistics A map of key,value pairs of client statistics.
 */
public StatisticsPanel(FreeColClient freeColClient,
                       Map<String, String> serverStatistics,
                       Map<String, String> clientStatistics) {
    super(freeColClient, new BorderLayout());

    // Title
    JPanel header = new JPanel();
    this.add(header, BorderLayout.PAGE_START);
    header.add(Utility.localizedLabel("statistics"), JPanel.CENTER_ALIGNMENT);

    // Actual stats panel
    JPanel statsPanel = new JPanel(new GridLayout(1,2));
    JScrollPane scrollPane = new JScrollPane(statsPanel,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    // correct way to make scroll pane opaque
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setBorder(null);

    this.add(scrollPane,BorderLayout.CENTER);
    statsPanel.add(displayStatsMessage("client", clientStatistics));
    statsPanel.add(displayStatsMessage("server", serverStatistics));

    add(okButton, BorderLayout.PAGE_END);

    setSize(getPreferredSize());
}
 
Example 50
Project: routerapp   File: GASettings.java   Source Code and License 5 votes vote down vote up
public void actionPerformed (ActionEvent evt) {
	centerPanel = new JPanel(new FlowLayout());

	maxGenerationsLabel = new JLabel("Max Generations");		
	maxGenerationsField = new JTextField((new Integer(TSProblemModel.DEFAULT_GA_MAX_GENERATIONS)).toString(), 5);
	
	popSizeLabel = new JLabel("Population Size");		
	popSizeField = new JTextField((new Integer(TSProblemModel.DEFAULT_GA_POP_SIZE)).toString(), 5);

	mutationRateLabel = new JLabel("Mutation Rate");		
	mutationRateField = new JTextField((new Double(TSProblemModel.DEFAULT_MUTATION_RATE)).toString(), 5);
	
	orderedCrossoverBox = new JCheckBox("Ordered Crossover", TSProblemModel.DEFAULT_ORDERED_CROSSOVER);
	cyclicCrossoverBox = new JCheckBox("Cyclic Crossover", TSProblemModel.DEFAULT_CYCLIC_CROSSOVER);
	pmxCrossoverBox = new JCheckBox("PMX Crossover", TSProblemModel.DEFAULT_PMX_CROSSOVER);
	simulatedAnnealingBox = new JCheckBox("Simulated Annealing", TSProblemModel.DEFAULT_ANNEAL);
	inverOverBox = new JCheckBox("Inver Over", TSProblemModel.DEFAULT_INVER_OVER);

	centerPanel.add(maxGenerationsLabel);
	centerPanel.add(maxGenerationsField);		
	centerPanel.add(popSizeLabel);
	centerPanel.add(popSizeField);
	centerPanel.add(mutationRateLabel);
	centerPanel.add(mutationRateField);			
	centerPanel.add(orderedCrossoverBox);
	centerPanel.add(cyclicCrossoverBox);	
	centerPanel.add(pmxCrossoverBox);
	centerPanel.add(inverOverBox);
	centerPanel.add(simulatedAnnealingBox);
	
	centerPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	centerPanel.setForeground(Color.getColor("202,198,202"));
	
	getContentPane().add(centerPanel,BorderLayout.CENTER);					
}
 
Example 51
Project: java-course   File: LinePanel.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new panel for given {@link Line} object.
 * 
 * @param line
 *            {@link Line} object.
 */
private static void createCirclePanel(Line line) {
    linePanel = new JPanel(new GridLayout(0, 2));
    startPoint = new JTextField(line.getStart().x + ", "
            + line.getStart().y);
    endPoint = new JTextField(line.getEnd().x + ", " + line.getEnd().y);
    fgColor = new JColorArea(line.getColor());

    linePanel.add(new JLabel("Start point: "));
    linePanel.add(startPoint);
    linePanel.add(new JLabel("End point: "));
    linePanel.add(endPoint);
    linePanel.add(new JLabel("FG Color: "));
    linePanel.add(fgColor);
}
 
Example 52
Project: jmt   File: SeedPanel.java   Source Code and License 5 votes vote down vote up
public void initialize() {
	JPanel edit = new JPanel(new GridLayout(4, 1, 0, 5));
	stepsLabel = new JLabel("Steps:");
	steps = new JSpinner(new SpinnerNumberModel(SPA.getNumberOfSteps(), 2, ParametricAnalysis.MAX_STEP_NUMBER, 1));
	steps.setToolTipText("Sets the number of performed simulations");
	edit.add(stepsLabel);
	edit.add(steps);
	edit.setPreferredSize(new Dimension(130, 108));
	JPanel editLables = new JPanel(new GridLayout(4, 1, 0, 5));
	editLables.add(stepsLabel);
	editLables.setPreferredSize(new Dimension(100, 108));
	JPanel editPanel = new JPanel();
	editPanel.add(editLables);
	editPanel.add(edit);
	editPanel.setBorder(new EmptyBorder(10, 20, 0, 20));
	JPanel cont = new JPanel(new BorderLayout());
	title = new TitledBorder("Simulation seed variation");
	cont.add(editPanel, BorderLayout.CENTER);
	scroll = new JScrollPane(cont);
	scroll.setBorder(title);
	description = new JTextArea(DESCRIPTION);
	description.setOpaque(false);
	description.setEditable(false);
	description.setLineWrap(true);
	description.setWrapStyleWord(true);
	descrPane = new JScrollPane(description);
	descriptionTitle = new TitledBorder(new EtchedBorder(), "Description");
	descrPane.setBorder(descriptionTitle);
	descrPane.setMinimumSize(new Dimension(80, 0));
	scroll.setMinimumSize(new Dimension(360, 0));
	setLeftComponent(scroll);
	setRightComponent(descrPane);
	setListeners();
	this.setBorder(new EmptyBorder(5, 0, 5, 0));
}
 
Example 53
Project: incubator-netbeans   File: SimpleTargetChooserPanel.java   Source Code and License 5 votes vote down vote up
public @Override Component getComponent() {
    if (noProjectFolders()) {
        return new JPanel();
    }
    if (gui == null) {
        gui = new SimpleTargetChooserPanelGUI(project, folders, bottomPanel == null ? null : bottomPanel.getComponent(), isFolder, freeFileExtension);
        gui.addChangeListener(this);
    }
    return gui;
}
 
Example 54
Project: incubator-netbeans   File: MainWindow.java   Source Code and License 5 votes vote down vote up
private static void decoratePanel (JPanel panel, boolean safeAccess) {
    assert safeAccess || SwingUtilities.isEventDispatchThread () : "Must run in AWT queue.";
    if (innerIconsPanel != null) {
        panel.remove (innerIconsPanel);
    }
    innerIconsPanel = getStatusLineElements (panel);
    if (innerIconsPanel != null) {
        panel.add (innerIconsPanel, BorderLayout.EAST);
    }
    if( isShowCustomBackground() )
        panel.setOpaque( false );
}
 
Example 55
Project: incubator-netbeans   File: CommentsPanel.java   Source Code and License 5 votes vote down vote up
private void layoutHeaderPanel(JPanel headerPanel, JLabel iconLabel, JLabel leftLabel, JLabel commentLabel, JLabel rightLabel, LinkButton replyButton, LinkButton mailtoButton, JLabel stateLabel) {
    GroupLayout layout = new GroupLayout(headerPanel);
    headerPanel.setLayout(layout);
    GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup()
        .addComponent(iconLabel)
        .addComponent(leftLabel);
    if (stateLabel != null) {
        hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
              .addComponent(stateLabel);
    }
    hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(commentLabel,0, 0, Short.MAX_VALUE)
          .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(rightLabel)
          .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(replyButton);
    if (mailtoButton != null) {
        hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
              .addComponent(mailtoButton);
    }
    layout.setHorizontalGroup(hGroup);
    
    GroupLayout.ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
        .addComponent(iconLabel)
        .addComponent(leftLabel);
    if (stateLabel != null) {
        vGroup.addComponent(stateLabel);
    }
    vGroup.addComponent(commentLabel)
          .addComponent(rightLabel)
          .addComponent(replyButton);
    if (mailtoButton != null) {
        vGroup.addComponent(mailtoButton);
    }
    layout.setVerticalGroup(vGroup);
}
 
Example 56
Project: Tarski   File: VizGUI.java   Source Code and License 5 votes vote down vote up
/** Add a vertical divider to the toolbar. */
private void addDivider() {
   JPanel divider = OurUtil.makeH(new Dimension(1, 40), Color.LIGHT_GRAY);
   divider.setAlignmentY(0.5f);
   if (!Util.onMac()) toolbar.add(OurUtil.makeH(5,background)); else toolbar.add(OurUtil.makeH(5));
   toolbar.add(divider);
   if (!Util.onMac()) toolbar.add(OurUtil.makeH(5,background)); else toolbar.add(OurUtil.makeH(5));
}
 
Example 57
Project: ObsidianSuite   File: TimelineFrame.java   Source Code and License 5 votes vote down vote up
public TimelineFrame(TimelineController controller)
{
	super("Timeline");
	this.controller = controller;
	this.actionsPanel = new ActionPointsPanel(controller);
	this.setJMenuBar(new TimelineMenuBar(controller.menubarController));
	
	mainPanel = new JPanel();
	mainPanel.add(controller.inputController.panel);
	mainPanel.add(createRightPane());

	setContentPane(mainPanel);
	pack();
	setAlwaysOnTop(true);
	
	if(Display.isVisible())
		setLocation(Display.getX() + 10, Display.getY() + 440);
	else
	{
		setLocationRelativeTo(null);
		setLocation(50, 420);
	}

	setResizable(false);

	addWindowListener(new WindowAdapter()
	{

		@Override
		public void windowClosing(WindowEvent e)
		{
			controller.close();
		}

	});
	
	controller.keyframeController.panel.refresthLineColours();
}
 
Example 58
Project: geomapapp   File: MCSSave.java   Source Code and License 5 votes vote down vote up
public void save() {
	JPanel panel = new JPanel( new GridLayout(0,1) );
	JLabel label = new JLabel("Save/Download");
	label.setForeground(Color.black);
	panel.add( label );
	ButtonGroup group = new ButtonGroup();
	JRadioButton jpeg = new JRadioButton("JPEG image");
	group.add(jpeg);
	panel.add( jpeg);
	JRadioButton segy = new JRadioButton("SEGY file");
	group.add(segy);
	panel.add( segy);
	nav = new JRadioButton("CDP Navigation");
	group.add(nav);
	panel.add( nav);
	JRadioButton history = new JRadioButton("processing history");
	group.add(history);
	panel.add( history);
	jpeg.setSelected(true);
	int ok = JOptionPane.showOptionDialog( image.getTopLevelAncestor(),
		panel,
		"cruise "+ image.getCruiseID() +", line "+ image.getID(),
		JOptionPane.OK_CANCEL_OPTION,
		JOptionPane.PLAIN_MESSAGE,
		null, null, null);
	if( ok== JOptionPane.CANCEL_OPTION) return;
	if( nav.isSelected() ||
		segy.isSelected()  
		|| history.isSelected() )saveSegy(history.isSelected());
	else saveJPEG();
}
 
Example 59
Project: JavaGraph   File: ConfigDialog.java   Source Code and License 4 votes vote down vote up
/** Factory method for the help panel. */
protected JComponent createHelpPanel() {
    return new JPanel();
}
 
Example 60
Project: openjdk-jdk10   File: bug8038113.java   Source Code and License 4 votes vote down vote up
@Override
public void init() {
    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {

            final JTree tree = new JTree();
            final BasicTreeUI treeUI = (BasicTreeUI) tree.getUI();

            final JPanel panel = new JPanel() {

                @Override
                public void paint(Graphics g) {
                    super.paint(g);
                    Graphics2D g2 = (Graphics2D) g;
                    g2.setStroke(new BasicStroke(0.5f));
                    g2.scale(2, 2);

                    int x = 10;
                    int y = 10;
                    Icon collapsedIcon = treeUI.getCollapsedIcon();
                    Icon expandeIcon = treeUI.getExpandedIcon();
                    int w = collapsedIcon.getIconWidth();
                    int h = collapsedIcon.getIconHeight();
                    collapsedIcon.paintIcon(this, g, x, y);
                    g.drawRect(x, y, w, h);

                    y += 10 + h;
                    w = expandeIcon.getIconWidth();
                    h = expandeIcon.getIconHeight();
                    expandeIcon.paintIcon(this, g, x, y);
                    g.drawRect(x, y, w, h);

                }
            };
            getContentPane().setLayout(new BorderLayout());
            getContentPane().add(panel, BorderLayout.CENTER);
        }
    });
}