Package javax.swing

Examples of javax.swing.JLabel


  private void initializeSettings(ProgramPanelSettings settings) {
    mMainPanel = new JPanel(new BorderLayout());
    mMainPanel.setOpaque(true);

    mHeaderLb = new JLabel();
    mMainPanel.add(mHeaderLb, BorderLayout.NORTH);

    mProgramPanel = new ProgramPanel(settings);
    mMainPanel.add(mProgramPanel, BorderLayout.CENTER);
  }
View Full Code Here


   * @see ListSelectionModel
   * @see ListModel
   */
  public Component getListCellRendererComponent(final JList list, Object value, final int index, boolean isSelected,
      boolean cellHasFocus) {
    JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

    if (value instanceof Program) {

      Program program = (Program) value;
      Insets borderInsets = label.getBorder().getBorderInsets(label);
      mProgramPanel.setWidth(list.getWidth() - borderInsets.left - borderInsets.right);
      mProgramPanel.setProgram(program);
      mProgramPanel.setPaintExpiredProgramsPale(!isSelected);
      mProgramPanel.setTextColor(label.getForeground());
      mProgramPanel.setBackground(label.getBackground());

      if (!mProgramSet.contains(program)) {
        mProgramSet.add(program);
        program.addChangeListener(new ProgramListChangeListener(list));
      }

      StringBuilder labelString = new StringBuilder();
      int days = program.getDate().getNumberOfDaysSince(Date.getCurrentDate());

      switch (days) {
      case -1: {
        labelString.append(Localizer.getLocalization(Localizer.I18N_YESTERDAY));
        labelString.append(", ").append(program.getDateString());
        break;
      }
      case 0: {
        labelString.append(Localizer.getLocalization(Localizer.I18N_TODAY));
        labelString.append(", ").append(program.getDateString());
        break;
      }
      case 1: {
        labelString.append(Localizer.getLocalization(Localizer.I18N_TOMORROW));
        labelString.append(", ").append(program.getDateString());
        break;
      }
      default: {
        labelString.append(program.getDate().toString());
      }
      }

      labelString.append(" - ").append(program.getChannel().getName());
      mHeaderLb.setText(labelString.toString());

      if (program.isExpired() && !isSelected) {
        mHeaderLb.setForeground(Color.gray);
      } else {
        mHeaderLb.setForeground(label.getForeground());
      }

      mMainPanel.setBackground(label.getBackground());

      if (isSelected) {
        mMainPanel.setForeground(label.getForeground());
      }

      mMainPanel.setEnabled(label.isEnabled());
      mMainPanel.setBorder(label.getBorder());

      if (((index & 1) == 1) && (!isSelected) && program.getMarkPriority() < Program.MIN_MARK_PRIORITY) {
        mMainPanel.setBackground(program.isExpired() ? SECOND_ROW_COLOR_EXPIRED : SECOND_ROW_COLOR);
      }

View Full Code Here

   * @param style enable style selection
   */
  public FontChooserPanel(String title, Font font, boolean style) {
    setLayout(new BorderLayout());
    if (title != null) {
      mTitle = new JLabel(title);
      add(mTitle, BorderLayout.NORTH);
    }
    JPanel innerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
    innerPanel.setBorder(BorderFactory.createEmptyBorder());

View Full Code Here

     */
    public ProgramTableCellRenderer(ProgramPanelSettings settings) {
        mMainPanel = new JPanel(new BorderLayout());
        mMainPanel.setOpaque(true);

        mHeaderLb = new JLabel();
        mMainPanel.add(mHeaderLb, BorderLayout.NORTH);

        mProgramPanel = new ProgramPanel(settings);
        mMainPanel.add(mProgramPanel, BorderLayout.CENTER);
    }
View Full Code Here

        mProgramPanel = new ProgramPanel(settings);
        mMainPanel.add(mProgramPanel, BorderLayout.CENTER);
    }

    public Component getTableCellRendererComponent(final JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
       
        if (value instanceof Program) {
            Program program = (Program) value;
            Insets borderInsets = label.getBorder().getBorderInsets(label);
            mProgramPanel.setWidth(table.getCellRect(row, column, false).width - borderInsets.left - borderInsets.right);
            mProgramPanel.setProgram(program);
           
            program.addChangeListener(new ChangeListener() {
              public void stateChanged(ChangeEvent e) {
                table.repaint();
              }
            });
           
            mProgramPanel.setPaintExpiredProgramsPale(!isSelected);
            mProgramPanel.setTextColor(label.getForeground());
            mProgramPanel.setBackground(label.getBackground());
           
            String dateString;
           
            if(program.getDate().equals(Date.getCurrentDate().addDays(-1))) {
              dateString = Localizer.getLocalization(Localizer.I18N_YESTERDAY);
            }
            else if(program.getDate().equals(Date.getCurrentDate())) {
              dateString = Localizer.getLocalization(Localizer.I18N_TODAY);
            }
            else if(program.getDate().equals(Date.getCurrentDate().addDays(1))) {
              dateString = Localizer.getLocalization(Localizer.I18N_TOMORROW);
            }
            else {
              dateString = program.getDate().toString();
            }
           
            mHeaderLb.setText(dateString + " - " + program.getChannel().getName());
           
            if(program.isExpired() && !isSelected) {
              mHeaderLb.setForeground(Color.gray);
            }
            else {
              mHeaderLb.setForeground(label.getForeground());
            }

            mMainPanel.setBackground(label.getBackground());
            mMainPanel.setForeground(label.getForeground());
            mMainPanel.setEnabled(label.isEnabled());
            mMainPanel.setBorder(label.getBorder());

            if (table.getRowHeight(row) != mMainPanel.getPreferredSize().height) {
              table.setRowHeight(row, mMainPanel.getPreferredSize().height);
            }
           
View Full Code Here

    mDialog = UiUtilities.createDialog(parent, true);

    JPanel content = (JPanel) mDialog.getContentPane();
    content.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    content.setLayout(new BorderLayout());
    mLabel = new JLabel(msg);
    mLabel.setHorizontalAlignment(SwingConstants.CENTER);
    content.add(mLabel, BorderLayout.CENTER);

    mBar = new JProgressBar();
    mBar.setVisible(false);
View Full Code Here

    pb.setDefaultDialogBorder();
   
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer() {
      public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JPanel background = new JPanel(new FormLayout("default:grow","fill:default:grow"));
        JLabel label = new JLabel(value.toString());
        label.setOpaque(false);
       
        if(isSelected) {
          background.setBackground(table.getSelectionBackground());
          label.setForeground(table.getSelectionForeground());
        }
        else {
          background.setBackground(table.getBackground());
        }
       
View Full Code Here

    private void createGui() {
        setLayout(new FormLayout("pref, 3dlu, fill:pref:grow", "pref, 3dlu, pref, 3dlu, pref"));
        setBorder(Borders.DLU4_BORDER);
        CellConstraints cc = new CellConstraints();

        add(new JLabel(mLocalizer.msg("ip", "IP of the Dreambox") + ":"), cc.xy(1, 1));

        mDreamAddress = new JTextField();
        mDreamAddress.setText(mOldAdress);
        mDreamAddress.getDocument().addDocumentListener(new DocumentListener() {
            public void insertUpdate(DocumentEvent event) {
                updateValue();
            }

            public void removeUpdate(DocumentEvent event) {
                updateValue();
            }

            public void changedUpdate(DocumentEvent event) {
                updateValue();
            }

            public void updateValue() {
                mProperties.setProperty("ip", mDreamAddress.getText());
            }
        });

        add(mDreamAddress, cc.xy(3, 1));

        add(new JLabel(mLocalizer.msg("user", "Username") + ":"), cc.xy(1, 3));
        mUsername = new JTextField();
        mUsername.setText(mOldUserName);
        mUsername.getDocument().addDocumentListener(new DocumentListener() {
            public void insertUpdate(DocumentEvent event) {
                updateValue();
            }

            public void removeUpdate(DocumentEvent event) {
                updateValue();
            }

            public void changedUpdate(DocumentEvent event) {
                updateValue();
            }

            public void updateValue() {
                mProperties.setProperty("username", mUsername.getText());
            }
        });
        add(mUsername, cc.xy(3, 3));

        add(new JLabel(mLocalizer.msg("password", "Password") + ":"), cc.xy(1, 5));
        mPassword = new JPasswordField();
        mPassword.setText(IOUtilities.xorDecode(mOldPassword, PASSWORDSEED));
        mPassword.getDocument().addDocumentListener(new DocumentListener() {
            public void insertUpdate(DocumentEvent event) {
                updateValue();
View Full Code Here

   * @return A text area containing the help text.
   */
  public static JTextArea createHelpTextArea(String msg) {
    JTextArea descTA = new JTextArea(msg);
    descTA.setBorder(BorderFactory.createEmptyBorder());
    descTA.setFont(new JLabel().getFont());
    descTA.setEditable(false);
    descTA.setOpaque(false);
    descTA.setWrapStyleWord(true);
    descTA.setLineWrap(true);
    descTA.setFocusable(false);
View Full Code Here

    // Quick "hack". Remove HTML-Code and replace it with Code that includes the
    // correct Font
    if (html.indexOf("<html>") >= 0) {
      html = StringUtils.substringBetween(html, "<html>", "</html>");
    }
    JLabel label = new JLabel();
    Font font = label.getFont();
    html = "<html><div style=\"color:" + UiUtilities.getHTMLColorCode(label.getForeground())+";font-family:" + font.getName()
        + "; font-size:" + font.getSize() +";background-color:rgb(" + background.getRed() + "," + background.getGreen() + "," + background.getBlue() + ");\">" + html + "</div></html>";

    final JEditorPane pane = new JEditorPane("text/html", html);
    pane.setBorder(BorderFactory.createEmptyBorder());
    pane.setEditable(false);
View Full Code Here

TOP

Related Classes of javax.swing.JLabel

Copyright © 2015 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.