Package javax.swing

Examples of javax.swing.JLabel


   */
  @Override
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
      int row, int column) {

    JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

    if (mCache[row][column] != null) {
      if (value instanceof Channel && ((ChannelLabel)mCache[row][column]).getChannel().equals(value)) {
        mCache[row][column].setForeground(label.getForeground());
        mCache[row][column].setBackground(label.getBackground());
        return mCache[row][column];
      } else if (value instanceof Program && mProgramPanel[row][column - 1].getProgram().equals(value)) {
        if (mProgramPanel[row][column - 1].getHeight() < table.getRowHeight(row)) {
          mProgramPanel[row][column - 1].setHeight(table.getRowHeight(row));
        } else if (mProgramPanel[row][column - 1].getHeight() > table.getRowHeight(row)) {
          int other = 0;
          if (column == 2) {
            other = 1;
          }

          int otherHeight = mProgramPanel[row][other].getHeight();

          int height = Math.max(mProgramPanel[row][column - 1].getHeight(), Math.max(table.getRowHeight(row), otherHeight));

          if (otherHeight < height) {
            mProgramPanel[row][other].setHeight(height);
          } else if (height < mProgramPanel[row][column - 1].getHeight()) {
            mProgramPanel[row][column - 1].setHeight(height);
          }

          table.setRowHeight(row, height);
        }
       
        mProgramPanel[row][column - 1].setTextColor(label.getForeground());
        mProgramPanel[row][column - 1].setBackground(label.getBackground());
        mCache[row][column].setForeground(label.getForeground());
        mCache[row][column].setBackground(label.getBackground());
        return mCache[row][column];
      } else {
        mCache[row][column] = null;
      }
    }

    if (value instanceof Channel) {
      Channel channel = (Channel) value;

      ChannelLabel channelLabel = new ChannelLabel();

      channelLabel.setChannel(channel);
      channelLabel.setOpaque(label.isOpaque());
      channelLabel.setForeground(label.getForeground());
      channelLabel.setBackground(label.getBackground());

      mCache[row][0] = channelLabel;
      updateHeight(table, row);

      return channelLabel;
    } else if (value instanceof Program) {
      int index = column - 1;

      Program program = (Program) value;

      mProgramPanel[row][index] = new ProgramPanel(program, new ProgramPanelSettings(ListViewPlugin.getInstance().getPictureSettings(),false, ProgramPanelSettings.X_AXIS));

      JPanel rpanel = new JPanel(new BorderLayout());
      rpanel.add(mProgramPanel[row][index], BorderLayout.CENTER);

      mProgramPanel[row][index].setTextColor(label.getForeground());

      if (ListViewPlugin.PROGRAMTABLEWIDTH > table.getColumnModel().getColumn(column).getMinWidth()) {
        int width = ListViewPlugin.PROGRAMTABLEWIDTH;
        table.getColumnModel().getColumn(column).setMinWidth(width);
      }

      mCache[row][column] = rpanel;
      mCache[row][column].setForeground(label.getForeground());
      mCache[row][column].setBackground(label.getBackground());

      updateHeight(table, row);

      return rpanel;
    }
   
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(label, BorderLayout.CENTER);
    panel.setBackground(label.getBackground());
   
    return panel;
  }
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("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

    panel2.add(panel3, BorderLayout.EAST);

    JPanel groupInfoPanel = new JPanel(new BorderLayout(3, 0));
    JPanel westPn = new JPanel(new BorderLayout());

    westPn.add(new JLabel(mLocalizer.msg("description", "Description:")), BorderLayout.NORTH);
    groupInfoPanel.add(westPn, BorderLayout.WEST);

    mGroupDescriptionTA = UiUtilities.createHelpTextArea("");
    mGroupDescriptionTA.setPreferredSize(new Dimension(0, 40));
View Full Code Here

    content.setLayout(new FormLayout("5dlu, 15dlu, fill:pref:grow, 3dlu, 100dlu",
            "pref, 3dlu,pref, 3dlu,pref, 3dlu,pref, 3dlu,pref, 3dlu,pref, 3dlu,pref, 3dlu,pref, fill:3dlu:grow ,pref, 3dlu,pref"));

    content.add(DefaultComponentFactory.getInstance().createSeparator(mLocalizer.msg("calendar", "Calendar")), cc.xyw(1,1,5));

    content.add(new JLabel(mLocalizer.msg("select", "Select Calendar:")), cc.xyw(2,3,2));
    mCalendarChooser = new JComboBox(new String[] {mLocalizer.msg("loading", "Loading list...")});
    mCalendarChooser.setEnabled(false);
    content.add(mCalendarChooser, cc.xy(5,3));

    content.add(DefaultComponentFactory.getInstance().createSeparator(mLocalizer.msg("reminder", "Reminder")), cc.xyw(1,5,5));

    mReminderCheckBox = new JCheckBox(mLocalizer.msg("reminderCheckbox", "Reminder"));
    mReminderCheckBox.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent event) {
        refreshEnabledElements();
      }
    });

    content.add(mReminderCheckBox, cc.xyw(2,7,4));

    mReminderText = new JLabel(mLocalizer.msg("minutesBefore", "Remind how many minutes before?"));
    content.add(mReminderText, cc.xy(3,9));

    Vector<GoogleComboboxItem> v = new Vector<GoogleComboboxItem>();
    v.add(new GoogleComboboxItem(    5, mLocalizer.msg("5_minutes", "5 minutes")));
    v.add(new GoogleComboboxItem(   10, mLocalizer.msg("10_minutes","10 minutes")));
View Full Code Here

 
  private void init() {
    this.setTitle(propertiesMgr.getValue("titleBuddyDialog"));   
    this.getContentPane().setLayout(new GridBagLayout());
       
    nameLabel = new JLabel(propertiesMgr.getValue("buddyName"));
    groupLabel = new JLabel(propertiesMgr.getValue("buddyGroup"));
    ok = new JButton(propertiesMgr.getValue("okForAddBuddy"));
    ok.addActionListener(this);
    cancel = new JButton(propertiesMgr.getValue("cancelForAddBuddy"));
    cancel.addActionListener(this);
    GridBagConstraints c = new GridBagConstraints();
View Full Code Here

      gridBagConstraints1.weightx = 1.0;
      gridBagConstraints1.gridy = 1;
      GridBagConstraints gridBagConstraints = new GridBagConstraints();
      gridBagConstraints.gridx = 0;
      gridBagConstraints.gridy = 0;
      waitTextLabel = new JLabel();
      waitTextLabel.setText(waitText);
      jContentPane = new JPanel();
      jContentPane.setLayout(new GridBagLayout());
      jContentPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED),
          BorderFactory.createBevelBorder(BevelBorder.LOWERED)));
View Full Code Here

    mBg = mSearchField.getBackground();
    mFg = mSearchField.getForeground();
   
    mComponent = comp;
    mMessage = new JLabel(mLocalizer.msg("notFound", "Phrase not found"));
    mMessage.setIcon(TVBrowserIcons.warning(TVBrowserIcons.SIZE_SMALL));
    mMessage.setVisible(false);
   
    install(comp);
View Full Code Here

      pb.add(mOldPrograms, cc.xyw(2,23,4));
     
      pb.add(mUseTime, cc.xyw(2,25,4));
     
      JPanel timeZonePanel = new JPanel(new FlowLayout(FlowLayout.LEFT,0,0));
      mTimeZoneLabel = new JLabel(mLocalizer.msg("Timezone","Timezone")+": ");
      mTimeZoneLabel.setEnabled(mTimeZones.isEnabled());
      timeZonePanel.add(mTimeZoneLabel);
      timeZonePanel.add(mTimeZones);
     
      pb.add(timeZonePanel, cc.xyw(3,26,3));
View Full Code Here

      mChannelTable.getTableHeader().setReorderingAllowed(false);
      mChannelTable.getColumnModel().getColumn(0).setCellRenderer(new ChannelTableCellRenderer());
      mChannelTable.getColumnModel().getColumn(1).setCellRenderer(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

    public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
      Component c = tableCellRenderer.getTableCellRendererComponent(table,
          value, isSelected, hasFocus, row, column);
      if (c instanceof JLabel) {
        JLabel l = (JLabel) c;
        l.setHorizontalTextPosition(SwingConstants.LEFT);
        int modelColumn = table.convertColumnIndexToModel(column);
        l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
      }
      return c;
    }
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.