Java 类javax.swing.JLabel 实例源码

项目:incubator-netbeans    文件:IndexListCellRenderer.java   
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;
}
项目:Progetto-B    文件:CardPanel.java   
/**
 * 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);

}
项目:FreeCol    文件:StatisticsPanel.java   
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;
}
项目:AgentWorkbench    文件:TableCellEditor4Domains.java   
@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;
}
项目:QN-ACTR-Release    文件:EpochPanel.java   
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);
}
项目:myster    文件:ProgressWindow.java   
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);
}
项目:Equella    文件:RawHtmlEditor.java   
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);
}
项目:20170612-NotaFIscalEletronica    文件:FrameCadastroNf.java   
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);

}
项目:VASSAL-src    文件:ZoneHighlight.java   
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;
    }
项目:Tarski    文件:EditorPalette.java   
/**
 * 
 */
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));
}
项目:incubator-netbeans    文件:QueryPanel.java   
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();
            }
        }
    });
}
项目:Wilmersdorf_SER316    文件:App.java   
/**
 * 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);
}
项目:jmt    文件:WhatIfPanel.java   
/**
 * 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;
}
项目:smile_1.5.0_java7    文件:SammonMappingDemo.java   
/**
 * 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);
}
项目:smile_1.5.0_java7    文件:ApproximateStringSearchDemo.java   
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);
}
项目:AgentWorkbench    文件:BaseAgents.java   
/**
 * 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());
}
项目:rapidminer    文件:SQLQueryBuilder.java   
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;
        }
    }

}
项目:geomapapp    文件:FocalMechanismSolutionDB.java   
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);
}
项目:jaer    文件:FiringModelMap.java   
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();
        }
项目:LivroJavaComoProgramar10Edicao    文件:MouseTrackerFrame.java   
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); 
}
项目:GIFKR    文件:SaveFrame.java   
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();
}
项目:incubator-netbeans    文件:IssuePanel.java   
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;
}
项目:oxygen-git-plugin    文件:BranchSelectDialog.java   
/**
 * 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);
}
项目:scorekeeperfrontend    文件:Timer.java   
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());
    }
}
项目:incubator-netbeans    文件:PalettePanel.java   
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();
            }
        });
    }
}
项目:javaportfolio    文件:UpdateQuoteManuallyDialog.java   
/**
 * 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());
}
项目:ants    文件:ScoreboardSmall.java   
private void createTurnsArea() {
    this.turnsLabel = new JLabel(TURN_LABEL);
    this.turnsText = new JTextField(5);
    this.turnsText.setEditable(false);
    add(this.turnsLabel);
    add(this.turnsText);
}
项目:incubator-netbeans    文件:StatusLineFactories.java   
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;
}
项目:incubator-netbeans    文件:ReflectionTextComponentUpdater.java   
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();
}
项目:jmt    文件:EpochPanel.java   
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);
}
项目:KSP-AGuS-Automatic-Guidance-System    文件:GUI_BASIC2.java   
/**
 * 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();

}
项目:incubator-netbeans    文件:ResolveDeclarationsPanel.java   
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);

}
项目:ramus    文件:NamedFontEditor.java   
/**
 * 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);
}
项目:incubator-netbeans    文件:SimpleDialogPanelTest.java   
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());
    }
}
项目:Progetto-B    文件:CardListener.java   
/**
 * 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;

}
项目:code-sentinel    文件:BaseDialogGUI.java   
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);
}
项目:VASSAL-src    文件:ServerAddressBook.java   
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$
}
项目:FreeCol    文件:NewUnitPanel.java   
/**
 * 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();
}
项目:projetomcdonalds    文件:Remove.java   
@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();
}
项目:zencash-swing-wallet-ui    文件:IdentityInfoDialog.java   
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);
}