Package javax.swing

Examples of javax.swing.JLabel


      gbc.gridy = 0;
      gbc.gridx = GridBagConstraints.RELATIVE;
      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.insets = new Insets(5, 0, 5, 0);
      gbc.fill = GridBagConstraints.NONE;
      addGb(new JLabel(Strings.get("labelCircuits") + " "));
      gbc.fill = GridBagConstraints.HORIZONTAL;
      addGb(new JScrollPane(list));
      gbc.fill = GridBagConstraints.NONE;
     
      gbc.gridy++;
      addGb(new JLabel(Strings.get("labelHeader") + " "));
      addGb(header);
     
      gbc.gridy++;
      addGb(new JLabel(Strings.get("labelRotateToFit") + " "));
      addGb(rotateToFit);
     
      gbc.gridy++;
      addGb(new JLabel(Strings.get("labelPrinterView") + " "));
      addGb(printerView);
    }
View Full Code Here


  public PrefOptionList(PrefMonitor<String> pref, StringGetter labelStr,
      PrefOption[] options) {
    this.pref = pref;
    this.labelStr = labelStr;
   
    label = new JLabel(labelStr.get() + " ");
    combo = new JComboBox();
    for (PrefOption opt : options) {
      combo.addItem(opt);
    }
   
View Full Code Here

    }
  }

  private static String promptForCircuitName(JFrame frame,
      Library lib, String initialValue) {
    JLabel label = new JLabel(Strings.get("circuitNamePrompt"));
    final JTextField field = new JTextField(15);
    field.setText(initialValue);
    JLabel error = new JLabel(" ");
    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints gc = new GridBagConstraints();
    JPanel strut = new JPanel(null);
    strut.setPreferredSize(new Dimension(3 * field.getPreferredSize().width / 2, 0));
    JPanel panel = new JPanel(gb);
    gc.gridx = 0;
    gc.gridy = GridBagConstraints.RELATIVE;
    gc.weightx = 1.0;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_START;
    gb.setConstraints(label, gc); panel.add(label);
    gb.setConstraints(field, gc); panel.add(field);
    gb.setConstraints(error, gc); panel.add(error);
    gb.setConstraints(strut, gc); panel.add(strut);
    JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE,
        JOptionPane.OK_CANCEL_OPTION);
    pane.setInitialValue(field);
    JDialog dlog = pane.createDialog(frame, Strings.get("circuitNameDialogTitle"));
    dlog.addWindowFocusListener(new WindowFocusListener() {
      public void windowGainedFocus(WindowEvent arg0) {
        field.requestFocus();
      }

      public void windowLostFocus(WindowEvent arg0) { }
    });
   
    while (true) {
      field.selectAll();
      dlog.pack();
      dlog.setVisible(true);
      field.requestFocusInWindow();
      Object action = pane.getValue();
      if (action == null || !(action instanceof Integer)
          || ((Integer) action).intValue() != JOptionPane.OK_OPTION) {
        return null;
      }

      String name = field.getText().trim();
      if (name.equals("")) {
        error.setText(Strings.get("circuitNameMissingError"));
      } else {
        if (lib.getTool(name) == null) {
          return name;
        } else {
          error.setText(Strings.get("circuitNameDuplicateError"));
        }
      }
    }
  }
View Full Code Here

      slider = new JSlider(JSlider.HORIZONTAL,
          -3 * SLIDER_DIVISIONS, 3 * SLIDER_DIVISIONS, 0);
      slider.setMajorTickSpacing(10);
      slider.addChangeListener(this);
      curScale = new JLabel("222%");
      curScale.setHorizontalAlignment(SwingConstants.RIGHT);
      curScale.setVerticalAlignment(SwingConstants.CENTER);
      curScaleDim = new Dimension(curScale.getPreferredSize());
      curScaleDim.height = Math.max(curScaleDim.height,
          slider.getPreferredSize().height);
      stateChanged(null);

      printerView = new JCheckBox();
      printerView.setSelected(true);

      // set up panel
      gridbag = new GridBagLayout();
      gbc = new GridBagConstraints();
      setLayout(gridbag);

      // now add components into panel
      gbc.gridy = 0;
      gbc.gridx = GridBagConstraints.RELATIVE;
      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.insets = new Insets(5, 0, 5, 0);
      gbc.fill = GridBagConstraints.NONE;
      addGb(new JLabel(Strings.get("labelCircuits") + " "));
      gbc.fill = GridBagConstraints.HORIZONTAL;
      addGb(new JScrollPane(list));
      gbc.fill = GridBagConstraints.NONE;
     
      gbc.gridy++;
      addGb(new JLabel(Strings.get("labelImageFormat") + " "));
      Box formatsPanel = new Box(BoxLayout.Y_AXIS);
      formatsPanel.add(formatPng);
      formatsPanel.add(formatGif);
      formatsPanel.add(formatJpg);
      addGb(formatsPanel);
     
      gbc.gridy++;
      addGb(new JLabel(Strings.get("labelScale") + " "));
      addGb(slider);
      addGb(curScale);
     
      gbc.gridy++;
      addGb(new JLabel(Strings.get("labelPrinterView") + " "));
      addGb(printerView);
    }
View Full Code Here

        boolean isSelected, int rowIndex, int columnIndex) {
      AttrTableModel attrModel = tableModel.attrModel;
      AttrTableModelRow row = attrModel.getRow(rowIndex);
     
      if (columnIndex == 0) {
        return new JLabel(row.getLabel());
      } else {
        if (currentEditor != null) currentEditor.transferFocus();

        Component editor = row.getEditor(parent);
        if (editor instanceof JComboBox) {
          ((JComboBox) editor).addActionListener(this);
          editor.addFocusListener(this);
        } else if (editor instanceof JInputComponent) {
          JInputComponent input = (JInputComponent) editor;
          MyDialog dlog;
          Window parent = AttrTable.this.parent;
          if (parent instanceof Frame) {
            dlog = new MyDialog((Frame) parent, input);
          } else {
            dlog = new MyDialog((Dialog) parent, input);
          }
          dlog.setVisible(true);
          Object retval = dlog.getValue();
          try {
            row.setValue(retval);
          } catch (AttrTableSetException e) {
            JOptionPane.showMessageDialog(parent, e.getMessage(),
                Strings.get("attributeChangeInvalidTitle"),
                JOptionPane.WARNING_MESSAGE);
          }
          editor = new JLabel(row.getValue());
        } else {
          editor.addFocusListener(this);
        }
        currentRow = row;
        currentEditor = editor;
View Full Code Here

        cpanel.setLayout(new BorderLayout());
       
        JPanel panel = new JPanel(new TabLayout(2));
        panel.setBorder(BorderFactory.createTitledBorder(mLocalizer.msg("details", "Details")));
       
        panel.add(new JLabel(mLocalizer.msg("name", "Name") + ":"));
        panel.add(new JLabel(mGroup.getName()));
       
        panel.add(new JLabel(mLocalizer.msg("provider", "Provider")+":"));
        panel.add(new JLabel(mGroup.getProviderName()));

        panel.add(new JLabel(mLocalizer.msg("url", "Url")+":"));

        String[] mirrors = mGroup.getMirrorArr();
        if (mirrors.length == 0) {
          panel.add(new JLabel("-"));
        }
        else {
          panel.add(new JLabel(mirrors[0] + "/" + mGroup.getId()));
        }

       
//        panel.add(new JLabel(mLocalizer.msg("webpage","WebPage") + ":"));
//        if (mGroup.getProviderWebPage() == null) {
//            panel.add(new JLabel(mLocalizer.msg("nowebpage", "Not availabe")));
//        } else {
//            LinkButton b = new LinkButton(mGroup.getProviderWebPage());
//            b.setHorizontalAlignment(LinkButton.LEFT);
//            panel.add(b);
//        }

        JPanel descPanel = new JPanel(new BorderLayout());
        descPanel.add(new JLabel(mLocalizer.msg("description","Description") + ":"), BorderLayout.NORTH);
        panel.add(descPanel);
        panel.add(createTextArea(mGroup.getDescription()));
       
        JPanel channelPanel = new JPanel(new BorderLayout());
        channelPanel.setBorder(BorderFactory.createTitledBorder(Localizer.getLocalization(Localizer.I18N_CHANNELS)));
View Full Code Here

     * @param text Text to show
     * @return filled Textarea
     */
    private JTextArea createTextArea(String text) {
        JTextArea chArea =new JTextArea(3,40);
        chArea.setFont(new JLabel().getFont());
        chArea.setLineWrap(true);
        chArea.setWrapStyleWord(true);
        chArea.setEditable(false);
        chArea.setOpaque(false);
        chArea.setText(text);
View Full Code Here

        });

        CellConstraints cc = new CellConstraints();

        JPanel panel = new JPanel(new FormLayout("1dlu,default,3dlu,default:grow", "pref,2dlu,pref,2dlu"));
        panel.add(new JLabel(Localizer.getLocalization(Localizer.I18N_CHANNELS) + ":"), cc.xy(2, 1));
        panel.add(mBox, cc.xy(4, 1));
        panel.add(new JLabel(mLocalizer.msg("filter", "Filter:")), cc.xy(2, 3));
        panel.add(mFilterBox, cc.xy(4, 3));

        mSendBtn = new JButton(TVBrowserIcons.copy(TVBrowserIcons.SIZE_SMALL));
        mSendBtn.setToolTipText(mLocalizer.msg("send", "Send to other Plugins"));
        mSendBtn.addActionListener(new ActionListener() {
View Full Code Here

      public void actionPerformed(ActionEvent e) {
        updateAfterServiceSelection();
      }
    });

    mServiceUrlLabel = new JLabel(mLocalizer.msg("Url", "Url") + ':');
    mServiceUrlLabel.setEnabled(mServiceCombo.getSelectedIndex() >= 2);

    mServiceUrlField = new JTextField();
    mServiceUrlField.setEnabled(mServiceCombo.getSelectedIndex() >= 2);
    mServiceUrlField.setText(mSettings.getBlogUrl());

    CellConstraints cc = new CellConstraints();

    settingsPanel.addRow();
    settingsPanel.add(new JLabel(mLocalizer.msg("Service", "Blog-Service") + ':'), cc.xy(2, settingsPanel.getRow()));
    settingsPanel.add(mServiceCombo, cc.xy(4, settingsPanel.getRow()));

    settingsPanel.addRow();
    settingsPanel.add(mServiceUrlLabel, cc.xy(2, settingsPanel.getRow()));
    settingsPanel.add(mServiceUrlField, cc.xyw(4, settingsPanel.getRow(), 2));
View Full Code Here

    public java.awt.Component getListCellRendererComponent(JList list,
        Object value, int index, boolean isSelected, boolean hasFocus) {
      java.awt.Component ret = super.getListCellRendererComponent(list,
        value, index, isSelected, hasFocus);
      if (ret instanceof JLabel && value instanceof SelectionItem) {
        JLabel label = (JLabel) ret;
        SelectionItem item = (SelectionItem) value;
        Component comp = item.getComponent();
        label.setIcon(new ComponentIcon(comp));
        label.setText(item.toString() + " - " + item.getRadix());
      }
      return ret;
    }
View Full Code Here

TOP

Related Classes of javax.swing.JLabel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.