Java Code Examples for javax.swing.JLabel

The following are top voted examples for showing how to use javax.swing.JLabel. 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: IndexListCellRenderer.java   Source Code and License 6 votes vote down vote up
public Component getListCellRendererComponent( JList list,
        Object value,
        int index,
        boolean isSelected,
        boolean cellHasFocus) {
    JLabel cr = (JLabel)super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );

    cr.setIcon( DocSearchIcons.getIcon( ((DocIndexItem)value).getIconIndex() ) );

    try {
        if (  ((DocIndexItem)value).getURL() == null )
            setForeground (java.awt.SystemColor.textInactiveText);
    }
    catch ( java.net.MalformedURLException e ) {
        setForeground (java.awt.SystemColor.textInactiveText);
    }
    return cr;
}
 
Example 2
Project: Progetto-B   File: CardPanel.java   Source Code and License 6 votes vote down vote up
/**
 * If a card has the choosen attribute(so it is among the choosen ones) it
 * removes it from the list of the choosen cards and it adds it to the
 * selectable one. If the card hasn't that attribute it removes it from the
 * selectable ones and ot adds it to the choosen one; if the choosen cards
 * form a tris it is a valid one, it sets true the visibility of the button
 * <code>playTris</code>.
 *
 * @param label
 */
public void switchCard(JLabel label) {
    boolean chosen = (boolean) label.getClientProperty("chosen");
    if (chosen) {
        chosenCards.remove(label);
        cards.add(label);
        cardsPane.setLayer(label, -(getNrCards() - 1));

    } else {

        chosenCards.add(label);
        cards.remove(label);
        cardsPane.setLayer(label, -(getNrChosenCards() - 1));
    }
    if (checkOnTris(chosenCards)) {
        int bonus = game.getBonusForTris(getTrisAsString(chosenCards));
        playTris.setText("Gioca il tris. (" + bonus + ")");
        playTris.setVisible(true);
    } else {
        playTris.setVisible(false);
    }

    label.putClientProperty("chosen", !chosen);

}
 
Example 3
Project: FreeCol   File: StatisticsPanel.java   Source Code and License 6 votes vote down vote up
private JPanel createStatsTable(String title, Map<String, String> data) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(new JLabel(title), BorderLayout.PAGE_START);
    StatisticsModel model = new StatisticsModel();
    model.setData(data);
    JTable table = new JTable(model);
    table.setAutoCreateColumnsFromModel(true);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    table.setAutoCreateRowSorter(true);
    JScrollPane scrollPane = new JScrollPane(table);
    table.addNotify();
    scrollPane.getViewport().setOpaque(false);
    scrollPane.getColumnHeader().setOpaque(false);
    panel.add(scrollPane, BorderLayout.CENTER);
    panel.setPreferredSize(new Dimension(300, (data.size()+2)*17));
    return panel;
}
 
Example 4
Project: AgentWorkbench   File: TableCellEditor4Domains.java   Source Code and License 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 5
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 6
Project: myster   File: ProgressWindow.java   Source Code and License 6 votes vote down vote up
public ProgressPanel() {
    setLayout(null);

    progressBar = new ProgressBar();
    progressBar.setLocation(PROGRESS_X_OFFSET, PROGRESS_Y_OFFSET);
    progressBar.setSize(440, 10);
    progressBar.setForeground(Color.blue);
    add(progressBar);

    textLabel = new JLabel();
    textLabel.setLocation(X_TEXT_OFFSET, Y_TEXT_OFFSET);
    textLabel.setSize(X_SIZE - X_TEXT_OFFSET - ADDITIONAL_X_SIZE, 20);
    add(textLabel);

    additionalLabel = new JLabel();
    additionalLabel.setLocation(X_SIZE - ADDITIONAL_X_SIZE, Y_TEXT_OFFSET);
    additionalLabel.setSize(ADDITIONAL_X_SIZE, 20);
    add(additionalLabel);
}
 
Example 7
Project: Equella   File: RawHtmlEditor.java   Source Code and License 6 votes vote down vote up
protected void createBottom()
{
	userHelp = new JLabel(CurrentLocale.get(
		"com.dytech.edge.admin.wizard.editor.rawhtmleditor.select", "\"{/xpath/to/my/data}\"")); //$NON-NLS-1$ //$NON-NLS-2$
	userRadio = new JRadioButton(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.rawhtmleditor.userdefined")); //$NON-NLS-1$
	userText = new I18nTextArea(BundleCache.getLanguages());

	Dimension d = new Dimension(0, 300);
	userText.setMinimumSize(d);
	userText.setPreferredSize(d);

	userText.setEnabled(false);
	userText.setEnabled(false);
	userHelp.setEnabled(false);
	userRadio.addActionListener(new RawHtmlEditor.RadioHandler(true));

	userPanel = new JPanel(new BorderLayout(5, 5));

	userPanel.add(userRadio, BorderLayout.NORTH);
	userPanel.add(userText, BorderLayout.CENTER);
	userPanel.add(userHelp, BorderLayout.SOUTH);
}
 
Example 8
Project: 20170612-NotaFIscalEletronica   File: FrameCadastroNf.java   Source Code and License 6 votes vote down vote up
private void contrutorPanelNff(){
	
	JPanel cadastroPanelNff1 = new JPanel();
	cadastroPanelNff1.setLayout(new BoxLayout(cadastroPanelNff1, BoxLayout.X_AXIS));
	cadastroPanelNff1.add(new JLabel("   Quantidade de itens: "));
	cadastroPanelNff1.add(quantidadeItens);
	cadastroPanelNff1.add(new JLabel("   Valor Total: "));
	cadastroPanelNff1.add(valorTotal);
	
	
	JPanel cadastroPanelNff2 = new JPanel();
	cadastroPanelNff2.setLayout(new BorderLayout());
	cadastroPanelNff2.add(new JLabel("   Informações: "));
	
	
	cadastroPanelNff.setLayout(new BoxLayout(cadastroPanelNff, BoxLayout.Y_AXIS));
	cadastroPanelNff.add(new JLabel(" "));
	cadastroPanelNff.add(cadastroPanelNff1);
	cadastroPanelNff.add(cadastroPanelNff2);
	cadastroPanelNff.add(informacoes);
	
}
 
Example 9
Project: VASSAL-src   File: ZoneHighlight.java   Source Code and License 6 votes vote down vote up
public Component getControls() {

      final JSlider slider = new JSlider(JSlider.HORIZONTAL,0,100,opacity);

      final HashMap<Integer,JLabel> labelTable = new HashMap<Integer,JLabel>();
      labelTable.put(0, new JLabel("Transparent"));
      labelTable.put(100, new JLabel("Opaque"));

      slider.setMajorTickSpacing(10);
      slider.setPaintTicks(true);
      // Note: JSlider uses the outdated Hashtable. Eventually Hashtable
      // will be deprecated and we'll be able to use the HashMap directly.
      slider.setLabelTable(new Hashtable<Integer,JLabel>(labelTable));
      slider.setPaintLabels(true);
      slider.setBorder(javax.swing.BorderFactory.createTitledBorder(name));
      slider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
          final JSlider source = (JSlider) e.getSource();
          if (!source.getValueIsAdjusting()) {
            opacity = source.getValue();
          }
        }});

      return slider;
    }
 
Example 10
Project: Tarski   File: EditorPalette.java   Source Code and License 6 votes vote down vote up
/**
 * 
 */
public void setSelectionEntry(JLabel entry, mxGraphTransferable t)
{
	JLabel previous = selectedEntry;
	selectedEntry = entry;

	if (previous != null)
	{
		previous.setBorder(null);
		previous.setOpaque(false);
	}

	if (selectedEntry != null)
	{
		selectedEntry.setBorder(ShadowBorder.getSharedInstance());
		selectedEntry.setOpaque(true);
	}

	eventSource.fireEvent(new mxEventObject(mxEvent.SELECT, "entry",
			selectedEntry, "transferable", t, "previous", previous));
}
 
Example 11
Project: incubator-netbeans   File: QueryPanel.java   Source Code and License 6 votes vote down vote up
public ExpandablePanel(JLabel l, JPanel p, final Icon ei, final Icon ci) {
    this.panel = p;
    this.label = l;
    this.ci = ci;
    this.ei = ei;
    this.label.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if(panel.isVisible()) {
                colapse();
            } else {
                expand();
            }
        }
    });
}
 
Example 12
Project: Wilmersdorf_SER316   File: App.java   Source Code and License 6 votes vote down vote up
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel jl = new JLabel();
	jl.setSize(400, 300);
	jl.setIcon(spl);
	splash.getContentPane().add(jl);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 13
Project: jmt   File: WhatIfPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Prepares the renderer by querying the data model for the
 * value and selection state
 * of the cell at <code>row</code>, <code>column</code>.
 * Returns the component (may be a <code>Component</code>
 * or a <code>JComponent</code>) under the event location.
 * <p/>
 *
 * This paints in red elements of selected classes
 *
 * @param renderer the <code>TableCellRenderer</code> to prepare
 * @param row      the row of the cell to render, where 0 is the first row
 * @param column   the column of the cell to render,
 *                 where 0 is the first column
 * @return the <code>Component</code> under the event location
 */
@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
	Component comp = super.prepareRenderer(renderer, row, column);
	if (comp instanceof JLabel) {
		((JLabel) comp).setHorizontalAlignment(SwingConstants.CENTER);
	}
	String name = (String) className.getSelectedItem();
	// Sets color of selected elements
	if ((name.equals(ALL_CLASSES) || getColumnName(column).equals(name)) && column != 0) {
		comp.setForeground(Color.RED);
	} else {
		comp.setForeground(getForeground());
	}
	// Changes background and font of headers
	if (column == 0 || row == 0) {
		comp.setBackground(this.getTableHeader().getBackground());
		comp.setFont(comp.getFont().deriveFont(Font.BOLD));
	} else {
		comp.setBackground(Color.WHITE);
		comp.setFont(comp.getFont().deriveFont(Font.PLAIN));
	}
	return comp;
}
 
Example 14
Project: smile_1.5.0_java7   File: SammonMappingDemo.java   Source Code and License 6 votes vote down vote up
/**
 * Constructor.
 */
public SammonMappingDemo() {
    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 15
Project: smile_1.5.0_java7   File: ApproximateStringSearchDemo.java   Source Code and License 6 votes vote down vote up
public ApproximateStringSearchDemo() {
    super(new BorderLayout());

    startButton = new JButton("Start");
    startButton.setActionCommand("startButton");
    startButton.addActionListener(this);

    knnField = new JTextField(Integer.toString(knn), 5);

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

    add(optionPane, BorderLayout.NORTH);

    canvas = new JPanel(new GridLayout(1, 2));
    canvas.setBackground(Color.WHITE);
    add(canvas, BorderLayout.CENTER);
}
 
Example 16
Project: AgentWorkbench   File: BaseAgents.java   Source Code and License 6 votes vote down vote up
/**
 * This method initializes this
 * @return void
 */
private void initialize() {
	jLabelAgent = new JLabel();
	jLabelAgent.setText("Agent:");
	jLabelAgent.setFont(new Font("Dialog", Font.BOLD, 12));
	jLabelStart = new JLabel();
	jLabelStart.setText("Starten als:");
	jLabelStart.setFont(new Font("Dialog", Font.BOLD, 12));

	
	this.setOneTouchExpandable(false);
	this.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
	this.setDividerSize(3);
	this.setResizeWeight(0.5);
	this.setSize(new Dimension(1003, 568));
	this.setLeftComponent(this.getJPanelWest());
	this.setRightComponent(this.getJPanelEast());
}
 
Example 17
Project: rapidminer   File: SQLQueryBuilder.java   Source Code and License 6 votes vote down vote up
public SQLQueryBuilder(Window owner, DatabaseHandler databaseHandler) {
    super(owner, "build_sql_query", ModalityType.APPLICATION_MODAL, new Object[0]);
    this.tableList = new JList(new DefaultListModel());
    this.attributeList = new JList(new DefaultListModel());
    this.whereTextArea = new JTextArea(4, 15);
    this.sqlQueryTextArea = new SQLEditor();
    this.surroundingDialog = null;
    this.connectionStatus = new JLabel();
    this.gridPanel = new JPanel(createGridLayout(1, 3));
    this.attributeNameMap = new LinkedHashMap();
    this.databaseHandler = databaseHandler;
    this.cache = TableMetaDataCache.getInstance();
    if(!"false".equals(ParameterService.getParameterValue("rapidminer.gui.fetch_data_base_table_names"))) {
        try {
            this.retrieveTableNames();
        } catch (SQLException var4) {
            SwingTools.showSimpleErrorMessage("db_connection_failed_simple", var4, new Object[0]);
            this.databaseHandler = null;
        }
    }

}
 
Example 18
Project: geomapapp   File: FocalMechanismSolutionDB.java   Source Code and License 6 votes vote down vote up
private void createDataDisplay() {
	dataDisplay = new JPanel(new BorderLayout());
	dataDisplay.setBorder( BorderFactory.createEmptyBorder(1, 1, 1, 1));

	kountLabel = new JLabel("<html>0 events<br> 0 shown</html>");
	kountLabel.setForeground( Color.black);
	kountLabel.setFont( new Font( "SansSerif", Font.PLAIN, 12));
	kountLabel.setBorder(BorderFactory.createLineBorder(Color.GRAY, 2));
	dataDisplay.add(kountLabel, BorderLayout.WEST);

	dataTextArea = new JTextArea(" ");
	dataTextArea.setEditable(false);
	dataTextArea.setRows(2);
	dataTextArea.setBorder( BorderFactory.createEmptyBorder(1, 4, 1, 1));
	dataTextArea.setFont(dataTextArea.getFont().deriveFont(10f));
	dataDisplay.add(dataTextArea);
}
 
Example 19
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 20
Project: LivroJavaComoProgramar10Edicao   File: MouseTrackerFrame.java   Source Code and License 6 votes vote down vote up
public MouseTrackerFrame()
{
   super("Demonstrating Mouse Events");

   mousePanel = new JPanel(); 
   mousePanel.setBackground(Color.WHITE); 
   add(mousePanel, BorderLayout.CENTER); // add panel to JFrame

   statusBar = new JLabel("Mouse outside JPanel"); 
   add(statusBar, BorderLayout.SOUTH); // add label to JFrame

   // create and register listener for mouse and mouse motion events
   MouseHandler handler = new MouseHandler(); 
   mousePanel.addMouseListener(handler); 
   mousePanel.addMouseMotionListener(handler); 
}
 
Example 21
Project: GIFKR   File: SaveFrame.java   Source Code and License 5 votes vote down vote up
public SaveFrame(Animation animation, ProgressDisplay d) {
	super("Save");
	this.animation = animation;
	this.d = d;

	initializeComponents();
	addActionListeners();

	setLayout(new GridBagLayout());
	GridBagConstraints gbc = ViewUtils.createGBC();

	JPanel spinPanel = new JPanel(new GridLayout(3,2));
	spinPanel.add(new JLabel("Width:"));
	spinPanel.add(widthSpinner);
	spinPanel.add(new JLabel("Height:"));
	spinPanel.add(heightSpinner);
	spinPanel.add(frameDelayLabel);
	spinPanel.add(frameDelaySpinner);

	add(spinPanel, gbc);
	gbc.gridy++;


	JLabel noteLabel = new JLabel("Filename conflicts will be resolved automatically");
	noteLabel.setFont(noteLabel.getFont().deriveFont(noteLabel.getFont().getSize() - 2f));
	add(noteLabel, gbc);
	gbc.gridy++;

	add(chooser, gbc);
	pack();
}
 
Example 22
Project: incubator-netbeans   File: IssuePanel.java   Source Code and License 5 votes vote down vote up
public FieldChangeListener (JComponent component, IssueField field, JLabel warningLabel,
        JComponent fieldLabel, String fieldName, Pair<IssueField, ? extends Object>... multiField) {
    this.component = component;
    this.field = field;
    this.warningLabel = warningLabel;
    this.fieldLabel = fieldLabel;
    this.fieldName = fieldName;
    this.decoratedFields = multiField;
}
 
Example 23
Project: oxygen-git-plugin   File: BranchSelectDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the information label to the dialog
 * 
 * @param gbc
 *          - the constraints used for this component
 */
private void addInformationLabel(GridBagConstraints gbc) {
	gbc.insets = new Insets(UIConstants.COMPONENT_TOP_PADDING, UIConstants.COMPONENT_LEFT_PADDING,
			UIConstants.COMPONENT_BOTTOM_PADDING, UIConstants.COMPONENT_RIGHT_PADDING);
	gbc.anchor = GridBagConstraints.WEST;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.gridx = 0;
	gbc.gridy = 1;
	gbc.weightx = 1;
	gbc.weighty = 0;
	gbc.gridwidth = 2;
	informationLabel = new JLabel();
	getContentPane().add(informationLabel, gbc);
}
 
Example 24
Project: scorekeeperfrontend   File: Timer.java   Source Code and License 5 votes vote down vote up
public Timer() throws IOException
{
	super(new BorderLayout());

	model = new TimerModel();
	table = new TimerTable(model);

	openPort = new JLabel("Serial Port Not Connected");
	openPort.setHorizontalAlignment(JLabel.CENTER);
	MyServerLabel slbl = new MyServerLabel();
	openPort.setBorder(BorderFactory.createLoweredBevelBorder());
	slbl.setBorder(BorderFactory.createLoweredBevelBorder());
	
	JPanel bottom = new JPanel(new MigLayout("fill, ins 0", "[50%]0[50%]"));
	bottom.add(openPort, "grow");
	bottom.add(slbl, "grow");

	JScrollPane scroll = new JScrollPane(table);
	scroll.getViewport().setBackground(Color.WHITE);
	scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
	scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

	add(controls(), BorderLayout.NORTH);
	add(scroll, BorderLayout.CENTER);
	add(bottom, BorderLayout.SOUTH);
	
	lights = new ButtonGroup();
	serial = null;
	
	try {
		server = new TimerServer(Discovery.BWTIMER_TYPE);
		model.addRunServerListener(server);
		server.start();
	} catch (IOException ioe) {
		log.log(Level.SEVERE, "\bTimer Server Failed to start: {0}", ioe.getMessage());
	}
}
 
Example 25
Project: incubator-netbeans   File: PalettePanel.java   Source Code and License 5 votes vote down vote up
private void prepareSearchPanel() {
    if( searchpanel == null ) {
        searchpanel = new SearchPanel();

        JLabel lbl = new JLabel(NbBundle.getMessage(PalettePanel.class, "LBL_QUICKSEARCH")); //NOI18N
        searchpanel.setLayout(new GridBagLayout());
        searchpanel.add(lbl, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(searchTextField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(new JLabel(), new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
        lbl.setLabelFor(searchTextField);
        searchTextField.setColumns(10);
        searchTextField.setMaximumSize(searchTextField.getPreferredSize());
        searchTextField.putClientProperty("JTextField.variant", "search"); //NOI18N
        lbl.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));

        JButton btnCancel = new JButton(ImageUtilities.loadImageIcon("org/netbeans/modules/palette/resources/cancel.png", true));
        btnCancel.setBorder(BorderFactory.createEmptyBorder());
        btnCancel.setBorderPainted(false);
        btnCancel.setOpaque(false);
        btnCancel.setContentAreaFilled(false);
        searchpanel.add(btnCancel, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        btnCancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                removeSearchField();
            }
        });
    }
}
 
Example 26
Project: javaportfolio   File: UpdateQuoteManuallyDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public UpdateQuoteManuallyDialog(Component frameComp,
		Component locationComp, String title, String name, String ticker,
		I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);
	priceField = new JTextField(11);
	nameField = new JTextField(11);
	tickerField = new JTextField(11);
	
	nameField.setEditable(false);
	nameField.setText(name);

	tickerField.setEditable(false);
	tickerField.setText(ticker);

	priceField.addKeyListener(this);

	nameFieldLabel = new JLabel("Nimi: ");
	nameFieldLabel.setLabelFor(nameField);

	tickerFieldLabel = new JLabel("Tunnus: ");
	tickerFieldLabel.setLabelFor(tickerField);

	dateFieldLabel = new JLabel("Noteerattu: ");
	dateFieldLabel.setLabelFor(dateChooser);

	priceFieldLabel = new JLabel("Noteeraus: ");
	priceFieldLabel.setLabelFor(priceField);
			
	updateRateField(name);
	
	init(getDialogLabels(), getDialogComponents());
}
 
Example 27
Project: ants   File: ScoreboardSmall.java   Source Code and License 5 votes vote down vote up
private void createTurnsArea() {
	this.turnsLabel = new JLabel(TURN_LABEL);
	this.turnsText = new JTextField(5);
	this.turnsText.setEditable(false);
	add(this.turnsLabel);
	add(this.turnsText);
}
 
Example 28
Project: incubator-netbeans   File: StatusLineFactories.java   Source Code and License 5 votes vote down vote up
static Component panelWithSeparator(JLabel cell) {
    JSeparator separator = new JSeparator(SwingConstants.VERTICAL) {
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(3, 3); // Y-unimportant -> gridlayout will stretch it
        }
    };
    separator.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(separator, BorderLayout.WEST);
    panel.add(cell);
    return panel;
}
 
Example 29
Project: incubator-netbeans   File: ReflectionTextComponentUpdater.java   Source Code and License 5 votes vote down vote up
public ReflectionTextComponentUpdater(String getter, Object model, Object defaults, JTextComponent field, JLabel label, ModelHandle2 handle, Operation operation) 
                    throws NoSuchMethodException {
    this(getter, null, model, defaults, field, label);
    assert handle != null;
    assert operation != null;
    this.operation = operation;
    this.handle2 = handle;
    initialValue2 = getValue();
}
 
Example 30
Project: jmt   File: EpochPanel.java   Source Code and License 5 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);
	this.add(epochOption, BorderLayout.NORTH);
}
 
Example 31
Project: KSP-AGuS-Automatic-Guidance-System   File: GUI_BASIC2.java   Source Code and License 5 votes vote down vote up
/**
 * Create the frame.
 */
public GUI_BASIC2(String name, DATA_SETTINGS data_SETTINGS, SETUP setup) {
	setTitle(name);
	this.settings = data_SETTINGS;
	this.setup = setup;
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	setBounds(100, 100, 297, 287);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	autoButton = new JButton("Start Autopilot");
	autoButton.setToolTipText("Starts the autopilot");
	autoButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
		}
	});
	autoButton.setBounds(46, 82, 186, 45);
	contentPane.add(autoButton);
	textLabel = new JLabel("Connected to " + settings.getHostname());
	textLabel.setBounds(28, 31, 221, 20);
	contentPane.add(textLabel);
	//textLabel.setColumns(10);
	button = new JButton("Execute Node");
	button.setToolTipText("Executes the next node for the current vessel");
	button.setBounds(46, 148, 186, 45);
	contentPane.add(button);
	consolebutton = new JButton("console");
	consolebutton.setBounds(98, 214, 89, 23);
	consolebutton.setToolTipText("Opens/Closes the console");
	contentPane.add(consolebutton);
	console = new GUI_CONSOLE("Missionlog");
	console.setLocationRelativeTo(this);
	console.setLocation(console.getLocation().x + 400, console.getLocation().y - 20);
	setup();

}
 
Example 32
Project: incubator-netbeans   File: ResolveDeclarationsPanel.java   Source Code and License 5 votes vote down vote up
private void initComponentsMore() {
    contentPanel.setLayout(new GridBagLayout());
    contentPanel.setBackground(UIManager.getColor("Table.background")); //NOI18N
    
    int row = 0;
    combos = new ArrayList<>(items.size());

    Font monoSpaced = new Font("Monospaced", Font.PLAIN, new JLabel().getFont().getSize()); //NOI18N
    FocusListener focusListener = new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            Component c = e.getComponent();
            Rectangle r = c.getBounds();
            contentPanel.scrollRectToVisible(r);
        }

    };
    for (int i = 0; i < items.size(); i++) {
        ResolveDeclarationItem item = items.get(i);
        JComboBox jComboBox = createComboBox(item, monoSpaced, focusListener);
        combos.add(jComboBox);

        JLabel lblSimpleName = new JLabel(item.getName());
        lblSimpleName.setOpaque(false);
        lblSimpleName.setFont(monoSpaced);
        lblSimpleName.setLabelFor(jComboBox);

        contentPanel.add(lblSimpleName, new GridBagConstraints(0, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 5, 2, 5), 0, 0));
        contentPanel.add(jComboBox, new GridBagConstraints(1, row++, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 2, 5), 0, 0));
    }

    contentPanel.add(new JLabel(), new GridBagConstraints(2, row, 2, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    Dimension d = contentPanel.getPreferredSize();
    d.height = getRowHeight() * Math.min(combos.size(), 6);

}
 
Example 33
Project: ramus   File: NamedFontEditor.java   Source Code and License 5 votes vote down vote up
/**
 * This method initializes this
 *
 * @return void
 */
private void initialize() {
    jLabel = new JLabel();
    setLayout(new BorderLayout());
    this.setSize(300, 23);
    setPreferredSize(new java.awt.Dimension(40, 20));
    jLabel.setText("JLabel");
    this.add(jLabel, java.awt.BorderLayout.WEST);
    this.add(getJPanel(), java.awt.BorderLayout.CENTER);
}
 
Example 34
Project: incubator-netbeans   File: SimpleDialogPanelTest.java   Source Code and License 5 votes vote down vote up
public void testLabels1() {
    SimpleDialogPanel.DialogDescriptor dd = new SimpleDialogPanel.DialogDescriptor(LABELS1);
    SimpleDialogPanel sdp = new SimpleDialogPanel(dd);
    JLabel[] labels = sdp.getLabels();
    for (int i=0,maxi=LABELS1.length; i<maxi; i++) {
        assertEquals(0, labels[i].getDisplayedMnemonic());
    }
}
 
Example 35
Project: Progetto-B   File: CardListener.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the final position for the movement of a card.
 *
 * @param label
 * @return
 */
private int getToX(JLabel label) {
    if ((boolean) label.getClientProperty("chosen")) {
        return X_OFFSET + HOR_OVERLAP * cardPanel.getNrCards();
    }
    return CHOSEN_OFFSET + cardPanel.getNrChosenCards() * HOR_OVERLAP;

}
 
Example 36
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 37
Project: VASSAL-src   File: ServerAddressBook.java   Source Code and License 5 votes vote down vote up
protected void addAdditionalControls(JComponent c, boolean enabled) {
  jabberUser.setEditable(enabled);
  jabberPw.setEditable(enabled);
  c.add(new JLabel(Resources.getString("ServerAddressBook.user_name"))); //$NON-NLS-1$
  c.add(jabberUser, "wrap, grow, push"); //$NON-NLS-1$
  c.add(new JLabel(Resources.getString("ServerAddressBook.password"))); //$NON-NLS-1$
  c.add(jabberPw, "wrap, grow, push"); //$NON-NLS-1$
}
 
Example 38
Project: FreeCol   File: NewUnitPanel.java   Source Code and License 5 votes vote down vote up
/**
 * The constructor to use.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param layout The {@code LayoutManager} to use.
 * @param label The label for the panel.
 * @param units A list of {@code UnitType}s to offer.
 */
public NewUnitPanel(FreeColClient freeColClient, LayoutManager layout,
                    String label, List<UnitType> units) {
    super(freeColClient, layout);

    this.question = new JLabel(label);
    this.units.addAll(units);
    final Europe europe = getMyPlayer().getEurope();
    this.priceComparator = Comparator.comparingInt((UnitType ut) ->
        europe.getUnitPrice(ut));

    okButton.setText(Messages.message("close"));

    update();
}
 
Example 39
Project: projetomcdonalds   File: Remove.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    buttonGroup1 = new javax.swing.ButtonGroup();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    painel_ingrediente = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    lista_ingrediente = new javax.swing.JList();
    lebel_titulo = new javax.swing.JLabel();
    btm_removeIngredientes = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setAlwaysOnTop(true);
    setResizable(false);
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    painel_ingrediente.setLayout(null);

    jScrollPane1.setViewportView(lista_ingrediente);

    painel_ingrediente.add(jScrollPane1);
    jScrollPane1.setBounds(10, 51, 258, 160);

    lebel_titulo.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
    lebel_titulo.setText("Remover Ingrediente");
    painel_ingrediente.add(lebel_titulo);
    lebel_titulo.setBounds(10, 11, 194, 22);

    btm_removeIngredientes.setText("REMOVER");
    painel_ingrediente.add(btm_removeIngredientes);
    btm_removeIngredientes.setBounds(10, 230, 130, 23);

    jTabbedPane1.addTab("Ingredientes", painel_ingrediente);

    getContentPane().add(jTabbedPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 400, 300));

    pack();
}
 
Example 40
Project: zencash-swing-wallet-ui   File: IdentityInfoDialog.java   Source Code and License 5 votes vote down vote up
private void addFormField(JPanel detailsPanel, String name, JComponent field)
{
	JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 2));
	JLabel tempLabel = new JLabel(name, JLabel.RIGHT);
	// TODO: hard sizing of labels may not scale!
	final int width = new JLabel("Sender identiication T address:").getPreferredSize().width + 10;
	tempLabel.setPreferredSize(new Dimension(width, tempLabel.getPreferredSize().height));
	tempPanel.add(tempLabel);
	tempPanel.add(field);
	detailsPanel.add(tempPanel);
}
 
Example 41
Project: Metodo-de-Gaus-Com-Pivot   File: Tela.java   Source Code and License 5 votes vote down vote up
private void gerarCamposNoInicio() {
    /**
     * Removendo todos componentes do painel da matriz
     */
    pnMatriz.removeAll();
    componentes = new ArrayList();
    
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j <= 2 + 1; j++) {
            if (j == 2) {
                JLabel lb = new JLabel("=");
                lb.setHorizontalAlignment(JLabel.CENTER);
                pnMatriz.add(lb);
            } else {
                JXTextField tf = new JXTextField();
                tf.setHorizontalAlignment(JXTextField.CENTER);
                tf.setSize(50, 50);
                if (j == 3) {
                    
                    tf.setPrompt("b" + (i + 1));
                    
                } else {
                    
                    tf.setPrompt("X" + (i + 1) + (j + 1));
                    
                }
                componentes.add(tf);
                pnMatriz.add(tf);
            }
        }
    }
}
 
Example 42
Project: sbc-qsystem   File: FTest.java   Source Code and License 5 votes vote down vote up
/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    String s = "w1,d2; g  3     f  ;4r e5r  ,  s   r6";
    System.out.println(s);
    //s="fsdjhdghy1zdfhsdgh";
    String ss[] = s.split("(\\s*,\\s*|\\s*;\\s*|\\s+)");
    System.out.println(ss.length + ": " + Arrays.toString(ss));

    String str = "centerO дореволюционной России.<br>Чтобы устроиться в «Экспедицию заготовления государственных бумаг» — аналог сегодняшнего Гознака — требовалось поручительство двух работников, знающих новичка лично. Если новичок не оправдывал доверия...<br>[right]увольнялись все трое.";
    str = str.trim().replaceFirst("^\\[.+?\\]", "");
    System.out.println("--" + str);
    if (1 == 1) {
        //     return ;
    }

    String text = "Привет волк!";
    Font ff = new Font("Arial", 0, 150);
    int len = 0;

    System.out.println("total=" + new JLabel().getFontMetrics(ff).stringWidth(text));
    for (int i = 0; i < text.length(); i++) {
        int l = new JLabel().getFontMetrics(ff).stringWidth(text.substring(i, i + 1));
        len = len + l;
        System.out.println(text.substring(i, i + 1) + "=" + l);
    }
    System.out.println("Сумма=" + len);

    java.awt.EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            new FTest().setVisible(true);
        }
    });
}
 
Example 43
Project: tttclass   File: CommonUtil.java   Source Code and License 5 votes vote down vote up
public static String getFilePath()
{
	JFileChooser jfc = new JFileChooser();
	jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
	jfc.showDialog(new JLabel(), "确定");
	return jfc.getSelectedFile() == null ? null
			: jfc.getSelectedFile().getAbsolutePath();
}
 
Example 44
Project: jmt   File: IterationSelector.java   Source Code and License 5 votes vote down vote up
/**
 * Initialize all gui objects
 */
private void initComponents() {
	setLayout(new BorderLayout());
	JPanel topPanel = new JPanel(new GridLayout(2, 1));
	topPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
	JLabel label = new JLabel("Execution number: ");
	final JSpinner spinner = new JSpinner();
	spinner.setPreferredSize(DIM_SPINNER);
	spinner.setValue(new Integer(1));
	label.setLabelFor(spinner);
	// Pack spinner and its label on top, while description is on the second line
	JPanel tmp = new JPanel();
	tmp.add(label);
	tmp.add(spinner);
	topPanel.add(tmp);
	description.setHorizontalAlignment(SwingConstants.CENTER);
	topPanel.add(description);
	// Adds state change to spinner.
	spinner.addChangeListener(new ChangeListener() {
		public void stateChanged(ChangeEvent e) {
			int i = ((Integer) spinner.getValue()).intValue();
			if (i <= 0) {
				i = 1;
			}
			if (i > model.getWhatIfValues().length) {
				i = model.getWhatIfValues().length;
			}
			select(i - 1);
			spinner.setValue(new Integer(i));
		}
	});

	add(topPanel, BorderLayout.NORTH);
	add(tabber, BorderLayout.CENTER);
	select(0);
}
 
Example 45
Project: incubator-netbeans   File: QueryTableCellRenderer.java   Source Code and License 5 votes vote down vote up
public void setStyleProperties(JLabel renderer, TableCellStyle style) {
    if (style != null) {
        renderer.putClientProperty(PROPERTY_FORMAT, style.format); // NOI18N
        renderer.putClientProperty(PROPERTY_HIGHLIGHT_PATTERN, style.highlightPattern); // NOI18N
        ((JComponent) renderer).setToolTipText(style.tooltip);
        setRowColors(style, renderer);
    }
}
 
Example 46
Project: xdman   File: ConfigDialog.java   Source Code and License 5 votes vote down vote up
Box createTypesPanel() {
	Box box = Box.createVerticalBox();
	box.setOpaque(false);
	box.setBorder(new EmptyBorder(10, 0, 0, 10));

	Box b0 = Box.createHorizontalBox();
	b0.add(new JLabel(getString("LBL_FILE_TYPES")));
	b0.setBorder(new EmptyBorder(0, 0, 10, 0));
	b0.add(Box.createHorizontalGlue());
	box.add(b0);

	txtArea = new JTextArea();
	txtArea.setWrapStyleWord(true);
	txtArea.setLineWrap(true);

	JScrollPane jsp = new JScrollPane(txtArea);
	jsp.setPreferredSize(new Dimension(10, 10));

	box.add(jsp);

	Box b = Box.createHorizontalBox();
	b.add(Box.createHorizontalGlue());

	defaults = new JButton(getString("LBL_DEFAULTS"));
	defaults.addActionListener(this);
	defaults.setName("LBL_DEFAULTS");

	b.add(defaults);
	b.setBorder(new EmptyBorder(5, 0, 5, 0));
	box.add(b);

	return box;
}
 
Example 47
Project: JITRAX   File: ErrorsDialog.java   Source Code and License 5 votes vote down vote up
public ErrorsDialog(ArrayList<String> errors) {
	okButton = new JButton("Ok");
	errorsTextArea = new JTextArea();
	
	setLayout(new BorderLayout());
	okButton.addActionListener(new OkButtonListener());
	errorsTextArea.setEditable(false);
	
	// Showing errors
	for (int i = 0; i < errors.size(); i++) {
		errorsTextArea.append(" - " + errors.get(i) + "\n");
	}
	
	JPanel mainContainer = new JPanel(new BorderLayout());
	JPanel messagePanel = new JPanel();
	JPanel buttonsPanel = new JPanel();
	messagePanel.add(new JLabel(MESSAGE));
	JScrollPane errorsPanelSP = new JScrollPane(errorsTextArea);
	errorsPanelSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	errorsPanelSP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
	
	mainContainer.setBorder(BorderFactory.createEmptyBorder(PADDING_TOP, 
			PADDING_LEFT, PADDING_BOTTOM, PADDING_RIGHT));
	
	buttonsPanel.add(okButton);
	mainContainer.add(messagePanel, BorderLayout.NORTH);
	mainContainer.add(errorsPanelSP, BorderLayout.CENTER);
	mainContainer.add(buttonsPanel, BorderLayout.SOUTH);
	
	add(mainContainer);
	buildWindow();
}
 
Example 48
Project: hearthstone   File: PanelHeroi.java   Source Code and License 5 votes vote down vote up
private void init() {
    setOpaque(false);
    congelado = new Congelado();
    heroi = new JLabel(imagemHeroi, JLabel.CENTER);
    animacao = new Animacao(hero);
    add(animacao, new AbsoluteConstraints(0, 0, imagemHeroi.getIconWidth(), imagemHeroi.getIconHeight()));
    add(congelado, AbsolutesConstraints.ZERO);
    add(heroi, AbsolutesConstraints.ZERO);
}
 
Example 49
Project: smile_1.5.0_java7   File: GMeansDemo.java   Source Code and License 5 votes vote down vote up
public GMeansDemo() {
    // Remove K TextFile
    optionPane.remove(optionPane.getComponentCount() - 1);
    optionPane.remove(optionPane.getComponentCount() - 1);

    maxClusterNumberField = new JTextField(Integer.toString(maxClusterNumber), 5);
    optionPane.add(new JLabel("Max K:"));
    optionPane.add(maxClusterNumberField);
}
 
Example 50
Project: incubator-netbeans   File: NotificationCenterTopComponent.java   Source Code and License 5 votes vote down vote up
private void init() {
        initComponents();
        detailsPanel = new JPanel(new GridLayout(1, 1));
        Color color = Utils.getTextBackground();
        detailsPanel.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue()));
        lblEmptyDetails = new JLabel(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_EmptyDetails"), JLabel.CENTER);
        lblEmptyDetails.setFont(italicFont);
        lblEmptyDetails.setEnabled(false);

        JScrollPane scrollPane = new JScrollPane(detailsPanel);
        splitPane.setRightComponent(scrollPane);

        toolBar.setFocusable(false);
        toolBar.setFloatable(false);
        btnSearch = new JToggleButton(ImageUtilities.loadImageIcon("org/netbeans/modules/notifications/resources/find16.png", true));
        btnSearch.setToolTipText(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_SearchToolTip"));
        btnSearch.setFocusable(false);
        btnSearch.setSelected(NotificationSettings.isSearchVisible());
        //TODO delete 2 lines then quick search API clear text correctly
//        btnSearch.setToolTipText("Disabled due to Quick Search API defects");
//        btnSearch.setEnabled(false);
        btnSearch.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSearchVisible(btnSearch.isSelected());
            }
        });
        toolBar.add(btnSearch);
        toolBar.add(new FiltersMenuButton(notificationManager.getActiveFilter()));

        initLeft();
        showDetails();
    }
 
Example 51
Project: geomapapp   File: EQ.java   Source Code and License 5 votes vote down vote up
public EQ(XMap map) {
	this.map = map;
	earthquakes=new Vector<EarthQuake>();
	initDialog();
	kountLabel = new JLabel("0 events, 0 shown");
	kountLabel.setForeground( Color.black);
	kountLabel.setFont( new Font( "SansSerif", Font.PLAIN, 12));
}
 
Example 52
Project: incubator-netbeans   File: SettingsPanel.java   Source Code and License 5 votes vote down vote up
private static int defaultHeight() {
    if (DEFAULT_HEIGHT == -1) {
        JPanel ref = new JPanel(null);
        ref.setLayout(new BoxLayout(ref, BoxLayout.LINE_AXIS));
        ref.setOpaque(false);
        
        ref.add(new JLabel("XXX")); // NOI18N
        
        ref.add(new JButton("XXX")); // NOI18N
        ref.add(new PopupButton("XXX")); // NOI18N
        
        ref.add(new JCheckBox("XXX")); // NOI18N
        ref.add(new JRadioButton("XXX")); // NOI18N
        
        ref.add(new JTextField("XXX")); // NOI18N
        
        ref.add(new JExtendedSpinner(new SpinnerNumberModel(1, 1, 655535, 1)));
        
        Component separator = Box.createHorizontalStrut(1);
        Dimension d = separator.getMaximumSize(); d.height = 20;
        separator.setMaximumSize(d);
        ref.add(separator);
        
        DEFAULT_HEIGHT = ref.getPreferredSize().height;
    }
    return DEFAULT_HEIGHT;
}
 
Example 53
Project: java-course   File: CirclePanel.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new panel for given {@link Circle} object.
 * 
 * @param circle
 *            {@link Circle} object.
 */
private static void createCirclePanel(Circle circle) {
    circlePanel = new JPanel(new GridLayout(0, 2));
    centerPoint = new JTextField(circle.getCenter().x + ", "
            + circle.getCenter().y);
    radiusText = new JTextField(String.valueOf(circle.getRadius()));
    fgColor = new JColorArea(circle.getColor());

    circlePanel.add(new JLabel("Center:"));
    circlePanel.add(centerPoint);
    circlePanel.add(new JLabel("Radius"));
    circlePanel.add(radiusText);
    circlePanel.add(new JLabel("FG Color:"));
    circlePanel.add(fgColor);
}
 
Example 54
Project: jmt   File: ServiceTimesPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Set up the panel contents and layout
 */
private void initComponents() {

	stTable = new STTable();

	Box hBox = Box.createHorizontalBox();
	hBox.add(Box.createHorizontalStrut(20));
	//Horizontal box containing Description label and buttons
	Box descrBox = Box.createVerticalBox();
	descrBox.add(new JLabel(DESCRIPTION_SERVICETIMES));
	descrBox.add(Box.createHorizontalStrut(10));
	descrBox.add(new JButton(SWITCH_TO_SD));
	descrBox.setPreferredSize(new Dimension(220, 1000));
	descrBox.setMinimumSize(new Dimension(200, 200));

	hBox.add(descrBox);
	hBox.add(Box.createHorizontalStrut(10));
	JScrollPane visitTablePane = new JScrollPane(stTable);
	visitTablePane.setPreferredSize(new Dimension(1000, 1000));
	visitTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
	visitTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	hBox.add(visitTablePane);
	hBox.add(Box.createHorizontalStrut(20));

	Box totalBox = Box.createVerticalBox();
	totalBox.add(Box.createVerticalStrut(30));
	totalBox.add(hBox);
	totalBox.add(Box.createVerticalStrut(30));

	setLayout(new BorderLayout());
	add(totalBox, BorderLayout.CENTER);

}
 
Example 55
Project: marathonv5   File: BorderDemo.java   Source Code and License 5 votes vote down vote up
void addCompForBorder(Border border, String description, Container container) {
    JPanel comp = new JPanel(new GridLayout(1, 1), false);
    JLabel label = new JLabel(description, JLabel.CENTER);
    comp.add(label);
    comp.setBorder(border);

    container.add(Box.createRigidArea(new Dimension(0, 10)));
    container.add(comp);
}
 
Example 56
Project: jaer   File: FilterPanel.java   Source Code and License 5 votes vote down vote up
void addTip(EventFilter f, JLabel label) {
    String s = f.getPropertyTooltip(label.getText());
    if (s == null) {
        return;
    }
    label.setToolTipText(s);
    label.setForeground(Color.BLUE);
}
 
Example 57
Project: javaportfolio   File: AccountTransferDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public AccountTransferDialog(Component frameComp, Component locationComp,
		String title,  Object[] brokers,I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	
	brokerList = new JComboBox(brokers);
	brokerList.setEditable(true);
	brokerList.setSelectedIndex(0);
	
	newBrokerField = new JTextField(FIELD_LEN);
	newBrokerField.setEditable(true);
	newBrokerField.setText("");		
	newBrokerField.addKeyListener(this);
	
	dateFieldLabel = new JLabel("Siirtopäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);
	
	brokerFieldLabel = new JLabel("Vanha välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);
	
	newBrokerFieldLabel = new JLabel("Uusi välittäjä: ");
	newBrokerFieldLabel.setLabelFor(newBrokerField);
	
	init(getDialogLabels(), getDialogComponents());
}
 
Example 58
Project: jdk8u-jdk   File: Test8007563.java   Source Code and License 4 votes vote down vote up
public void run() {
    if (this.frame == null) {
        if (!updateLookAndFeel()) {
            return;
        }
        this.pane = new JTabbedPane();
        this.pane.setOpaque(false);
        this.pane.setBackground(Color.RED);
        for (int i = 0; i < 3; i++) {
            this.pane.addTab("Tab " + i, new JLabel("Content area " + i));
        }
        this.frame = new JFrame(getClass().getSimpleName());
        this.frame.getContentPane().setBackground(Color.BLUE);
        this.frame.add(this.pane);
        this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        this.frame.setSize(400, 200);
        this.frame.setLocationRelativeTo(null);
        this.frame.setVisible(true);
    } else {
        Point point = new Point(this.pane.getWidth() - 2, 2);
        convertPointToScreen(point, this.pane);
        Color actual = ROBOT.getPixelColor(point.x, point.y);

        boolean opaque = this.pane.isOpaque();
        Color expected = opaque
                ? this.pane.getBackground()
                : this.frame.getContentPane().getBackground();

        if (!expected.equals(actual)){
            addOpaqueError(opaque);
        }
        if (!opaque) {
            this.pane.setOpaque(true);
            this.pane.repaint();
        } else {
            this.frame.dispose();
            this.frame = null;
            this.pane = null;
            LATCH.countDown();
        }

    }
    invokeLater(this);
}
 
Example 59
Project: Star-Ride--RiverRaid   File: Enemy.java   Source Code and License 4 votes vote down vote up
public JLabel getEnemy() {
    return enemy;
}
 
Example 60
Project: Course-Management-System   File: RemoveStudentDialog.java   Source Code and License 4 votes vote down vote up
/**
 * Create the dialog.
 */
public RemoveStudentDialog() {
	setVisible(true);
	setTitle("Remove Student");
	setBounds(100, 100, 450, 300);
	getContentPane().setLayout(new BorderLayout());
	contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
	getContentPane().add(contentPanel, BorderLayout.CENTER);
	contentPanel.setLayout(null);
	
	JLabel lblEnterTheRoll = new JLabel("Enter the Roll Number of the student to be removed :");
	lblEnterTheRoll.setBounds(21, 66, 360, 14);
	contentPanel.add(lblEnterTheRoll);
	
	textField = new JTextField();
	textField.setBounds(21, 93, 297, 20);
	contentPanel.add(textField);
	textField.setColumns(10);
	{
		JPanel buttonPane = new JPanel();
		buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
		getContentPane().add(buttonPane, BorderLayout.SOUTH);
		{
			JButton okButton = new JButton("Submit");
			okButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
				try
				{
					// obtaining the roll number of the student to be removed
					String rollno=textField.getText();
					StudentDAO dao=new StudentDAO();
					Student stud=dao.getStudentByRollno(rollno);
					// checking if the roll number is a valid roll number that is whether it exists in the database or not
					if(stud!=null)
					{
						StudentDbHandler sdbh=new StudentDbHandler();
						sdbh.removeStudent(rollno);
						// calling the method of the StudentDbHandler to remove the student using the roll number
						JOptionPane.showMessageDialog(RemoveStudentDialog.this,"Successfully removed the student from the database","Info : ",JOptionPane.INFORMATION_MESSAGE);
						// on removal of the student display suitable message of success in removing the student
						// hide the dialog box and dispose it when the student has been successfully removed 
						RemoveStudentDialog.this.setVisible(false);
						RemoveStudentDialog.this.dispose();
					}	
					else
					{
						JOptionPane.showMessageDialog(RemoveStudentDialog.this,"No such Rollno exists in the database","Alert : ",JOptionPane.WARNING_MESSAGE);
					}	
				}
				catch(Exception e)
				{
					e.printStackTrace();
					JOptionPane.showMessageDialog(RemoveStudentDialog.this,e.getMessage(),"Error : ",JOptionPane.ERROR_MESSAGE);
				}
				}
			});
			okButton.setActionCommand("OK");
			buttonPane.add(okButton);
			getRootPane().setDefaultButton(okButton);
		}
		{
			JButton cancelButton = new JButton("Cancel");
			cancelButton.setActionCommand("Cancel");
			buttonPane.add(cancelButton);
		}
	}
}