public PE1212_UseLabels() {
    setLayout(new FlowLayout());

    ImageIcon usFlag = new ImageIcon("C://Java//site//image//usIcon.gif");

    JLabel jlbl1 = new JLabel(usFlag);
    jlbl1.setText("US");
    jlbl1.setHorizontalTextPosition(JLabel.CENTER);
    jlbl1.setVerticalTextPosition(JLabel.BOTTOM);

    JLabel jlbl2 = new JLabel(usFlag);
    jlbl2.setText("US");
    jlbl2.setHorizontalTextPosition(JLabel.RIGHT);

    JLabel jlbl3 = new JLabel(usFlag);
    jlbl3.setText("US");
    jlbl3.setHorizontalTextPosition(JLabel.LEFT);

    JLabel jlbl4 = new JLabel(usFlag);
    jlbl4.setText("US");
    jlbl4.setHorizontalTextPosition(JLabel.CENTER);
    jlbl4.setVerticalTextPosition(JLabel.TOP);

    add(jlbl1);
    add(jlbl2);
    add(jlbl3);
    add(jlbl4);
  }
Beispiel #2
0
  /** Default constructor for the demo. */
  public IconDemoApp() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Icon Demo: Please Select an Image");

    // A label for displaying the pictures
    photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
    photographLabel.setHorizontalTextPosition(JLabel.CENTER);
    photographLabel.setHorizontalAlignment(JLabel.CENTER);
    photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // We add two glue components. Later in process() we will add thumbnail buttons
    // to the toolbar inbetween thease glue compoents. This will center the
    // buttons in the toolbar.
    buttonBar.add(Box.createGlue());
    buttonBar.add(Box.createGlue());

    add(buttonBar, BorderLayout.SOUTH);
    add(photographLabel, BorderLayout.CENTER);

    setSize(400, 300);

    // this centers the frame on the screen
    setLocationRelativeTo(null);

    // start the image loading SwingWorker in a background thread
    loadimages.execute();
  }
  /** Create the panel. */
  public authorJPanel() {
    setBackground(Color.BLACK);
    setLayout(null);

    JLabel lblIot = new JLabel("IOT 13-1");
    lblIot.setHorizontalTextPosition(SwingConstants.CENTER);
    lblIot.setHorizontalAlignment(SwingConstants.CENTER);
    lblIot.setFont(new Font("SAO UI", Font.BOLD, 51));
    lblIot.setForeground(Color.WHITE);
    lblIot.setBounds(377, 61, 193, 102);
    add(lblIot);

    JLabel lblHanShukai = new JLabel(" Han Shukai");
    lblHanShukai.setIcon(new ImageIcon(authorJPanel.class.getResource("/image/skills_normal.png")));
    lblHanShukai.setForeground(Color.WHITE);
    lblHanShukai.setFont(new Font("SAO UI", Font.BOLD, 51));
    lblHanShukai.setBounds(345, 189, 250, 102);
    add(lblHanShukai);

    JLabel label = new JLabel("");
    label.setIcon(new ImageIcon(authorJPanel.class.getResource("/image/bniang.jpg")));
    label.setForeground(Color.WHITE);
    label.setFont(new Font("SAO UI", Font.BOLD, 51));
    label.setBounds(101, 104, 128, 266);
    add(label);

    //		JLabel lblGongchen = new JLabel(" GongChen");
    //		lblGongchen.setIcon(new
    // ImageIcon(authorJPanel.class.getResource("/image/skills_normal.png")));
    //		lblGongchen.setForeground(Color.WHITE);
    //		lblGongchen.setFont(new Font("SAO UI", Font.BOLD, 51));
    //		lblGongchen.setBounds(345, 300, 225, 102);
    //		add(lblGongchen);

  }
 /** Setst the status label to alert the user that a word has not been found. */
 public void setStatusLabelWithFailedFind() {
   log.info(
       "NOT FOUND - Findvalue[" + findField.getText() + "] displaying statusInfo to the user");
   statusInfo.setHorizontalTextPosition(SwingConstants.RIGHT);
   statusInfo.setIcon(IconManager.getIcon("Error", IconManager.IconSize.Std16));
   statusInfo.setText(getResourceString("SS_SR_PHRASENOTFOUND"));
 }
 /**
  * Setst the status label to alert the user that the end of the table is has been reached during
  * the search.
  */
 public void setStatusLabelEndReached() {
   log.info(
       "NOT FOUND - Findvalue[" + findField.getText() + "] displaying statusInfo to the user");
   statusInfo.setHorizontalTextPosition(SwingConstants.RIGHT);
   statusInfo.setIcon(IconManager.getIcon("ValidationValid", IconManager.IconSize.Std16));
   statusInfo.setText(getResourceString("SS_SR_ENDOFTABLE"));
 }
  private static JLabel getLabel(final AccountGroup group, final Icon icon) {
    JLabel label = new JLabel(group.toString(), icon, JLabel.LEFT);
    label.setHorizontalTextPosition(JLabel.LEFT);

    label.setFont(label.getFont().deriveFont(label.getFont().getSize2D() - 2f));
    return label;
  }
Beispiel #7
0
  public static void main(String[] args) {
    JPanel panel = new JPanel();
    JPanel sub1 = new PushCounterPanel(Color.yellow);
    JPanel sub2 = new CalculatorPanel();
    panel.add(sub1);
    panel.add(sub2);

    // 八爪猫实力上镜展示panel,label,imageIcon
    ImageIcon icon = new ImageIcon("resource/octocat.jpeg");
    icon.setImage(icon.getImage().getScaledInstance(30, 30, Image.SCALE_DEFAULT));
    JLabel label1 =
        new JLabel(
            "Cat on the left", icon, SwingConstants.CENTER); // 第三个参数,label在panel中水平方向定位,默认为CENTER
    JLabel label2 = new JLabel("Cat on the right");
    label2.setIcon(icon);
    label2.setHorizontalTextPosition(SwingConstants.LEFT); // label中,文字相对图像的水平位子,默认为RIGHT
    label2.setVerticalTextPosition(SwingConstants.BOTTOM); // label中,文字相对图像的垂直位子,默认为CENTER
    JPanel sub3 = new JPanel();
    sub3.add(label1);
    sub3.add(label2);
    sub3.setPreferredSize(new Dimension(150, 120)); // subPanel大小,否则以一行形式往右延展
    panel.add(sub3);

    JPanel sub4 = new CheckBoxPanel();
    panel.add(sub4);
    JPanel sub5 = new RadioButtonPanel();
    panel.add(sub5);

    JFrame jframe = new JFrame("HelloWorld");
    jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jframe.getContentPane().add(panel); // 自建类
    jframe.pack(); // 必备,否则无初始大小
    jframe.setVisible(true); // 必备,否则不可见
  }
Beispiel #8
0
    public IndicatorToolbox() {
      super(JToolBar.HORIZONTAL);
      setOpaque(false);
      setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

      indicatorLabel = new JLabel(indicator.getLabel());
      indicatorLabel.setHorizontalTextPosition(SwingConstants.LEFT);
      indicatorLabel.setVerticalTextPosition(SwingConstants.CENTER);
      indicatorLabel.setOpaque(false);
      add(indicatorLabel);

      container = new JPanel();
      container.setOpaque(false);
      container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
      add(container);
      update();

      addMouseListener(
          new MouseAdapter() {
            public @Override void mouseEntered(MouseEvent e) {
              mouseOver = true;
              validate();
              repaint();
            }

            public @Override void mouseExited(MouseEvent e) {
              setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
              mouseOver = false;
              validate();
              repaint();
            }
          });
    }
Beispiel #9
0
  public LabelDemo() {
    super(new GridLayout(3, 1)); // 3 rows, 1 column
    JLabel label1, label2, label3;

    ImageIcon icon = createImageIcon("images/middle.gif", "a pretty but meaningless splat");

    // Create the first label.
    label1 = new JLabel("Image and Text", icon, JLabel.CENTER);
    // Set the position of its text, relative to its icon:
    label1.setVerticalTextPosition(JLabel.BOTTOM);
    label1.setHorizontalTextPosition(JLabel.CENTER);

    // Create the other labels.
    label2 = new JLabel("Text-Only Label");
    label3 = new JLabel(icon);

    // Create tool tips, for the heck of it.
    label1.setToolTipText("A label containing both image and text");
    label2.setToolTipText("A label containing only text");
    label3.setToolTipText("A label containing only an image");

    // Add the labels.
    add(label1);
    add(label2);
    add(label3);
  }
 public UnsupportedVideo(String url) {
   JLabel label = new JLabel(UIResourceManager.getIcon(UIResourceManager.ICON_ERROR));
   label.setToolTipText("The video could not be loaded: " + url);
   label.setHorizontalTextPosition(JLabel.CENTER);
   label.setVerticalTextPosition(JLabel.VERTICAL);
   label.setSize(label.getPreferredSize());
   component = label;
 }
 public JLabel createLabel(String title, ImageIcon image, JPanel _p) {
   title = "<html><font size=\"-2\" face=\"Arial\"><center>" + title + "</center></font></html>";
   JLabel j = new JLabel(title, image, JLabel.CENTER);
   j.setVerticalTextPosition(JLabel.BOTTOM);
   j.setHorizontalTextPosition(JLabel.CENTER);
   _p.add(j);
   return j;
 }
Beispiel #12
0
 private JLabel getJLabelStaffSignIn() {
   if (jLabelStaffSignIn == null) {
     jLabelRectangular = new JLabel();
     jLabelRectangular.setBounds(new Rectangle(360, 469, 651, 11));
     jLabelRectangular.setIcon(
         new ImageIcon(getClass().getResource("/simplytech/image/Rectangle.png")));
     jLabelRectangular.setText("JLabel");
     jLabelSimplyTech = new JLabel();
     jLabelSimplyTech.setBounds(new Rectangle(780, 134, 198, 36));
     jLabelSimplyTech.setIcon(
         new ImageIcon(getClass().getResource("/simplytech/image/by simplytech.png")));
     jLabelSimplyTech.setText("");
     jLabelCheckmate = new JLabel();
     jLabelCheckmate.setBounds(new Rectangle(646, 30, 331, 94));
     jLabelCheckmate.setIcon(
         new ImageIcon(getClass().getResource("/simplytech/image/Checkmate.png")));
     jLabelCheckmate.setText("");
     jLabelStaffSignInPict = new JLabel();
     jLabelStaffSignInPict.setBounds(new Rectangle(3, 1, 266, 216));
     jLabelStaffSignInPict.setIcon(
         new ImageIcon(getClass().getResource("/simplytech/image/StaffSignInImage.png")));
     jLabelStaffSignInPict.setText("");
     jLabelPassword = new JLabel();
     jLabelPassword.setBounds(new Rectangle(166, 286, 180, 30));
     jLabelPassword.setHorizontalAlignment(SwingConstants.CENTER);
     jLabelPassword.setHorizontalTextPosition(SwingConstants.CENTER);
     jLabelPassword.setText("Password:"******"Calibri", Font.PLAIN, 14));
     jLabelStaffID = new JLabel();
     jLabelStaffID.setBounds(new Rectangle(167, 239, 175, 29));
     jLabelStaffID.setHorizontalAlignment(SwingConstants.CENTER);
     jLabelStaffID.setHorizontalTextPosition(SwingConstants.CENTER);
     jLabelStaffID.setText("Staff ID:");
     jLabelStaffID.setFont(new Font("Calibri", Font.PLAIN, 14));
     jLabelStaffSignIn = new JLabel();
     jLabelStaffSignIn.setBounds(new Rectangle(376, 150, 179, 63));
     jLabelStaffSignIn.setFont(new Font("Arial", Font.BOLD, 18));
     jLabelStaffSignIn.setHorizontalTextPosition(SwingConstants.RIGHT);
     jLabelStaffSignIn.setHorizontalAlignment(SwingConstants.LEADING);
     jLabelStaffSignIn.setIcon(
         new ImageIcon(getClass().getResource("/simplytech/image/RedThingy.png")));
     jLabelStaffSignIn.setText("Staff Sign In");
   }
   return jLabelStaffSignIn;
 }
Beispiel #13
0
 public JLabel label(String desc) {
   if (desc == null) {
     desc = "" + getGoodness();
   }
   JLabel l = new JLabel(desc, new ImageIcon(toImage()), SwingConstants.CENTER);
   l.setVerticalTextPosition(SwingConstants.BOTTOM);
   l.setHorizontalTextPosition(SwingConstants.CENTER);
   return l;
 }
 public ChatStatePanel(ChatState state, String nickname) {
   setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1));
   JLabel label = new JLabel(Res.getString(state.name(), nickname));
   label.setFont(new Font("Courier New", Font.PLAIN, 9));
   label.setForeground(Color.gray);
   label.setHorizontalTextPosition(JLabel.LEFT);
   label.setVerticalTextPosition(JLabel.BOTTOM);
   add(label);
 }
Beispiel #15
0
  private Component inputPanel() {
    inputLabel = new JLabel(defaultMessage);

    inputLabel.setHorizontalTextPosition(JLabel.CENTER);
    inputLabel.setBorder(
        BorderFactory.createTitledBorder(window.getObjectsName()[9][window.getSelectedLenguage()]));

    return inputLabel;
  }
 private JLabel getQuestionLabel() {
   if (questionLabel == null) {
     questionLabel = new JLabel();
     questionLabel.setBounds(new Rectangle(0, 58, 324, 12));
     questionLabel.setHorizontalAlignment(SwingConstants.CENTER);
     questionLabel.setHorizontalTextPosition(SwingConstants.CENTER);
     questionLabel.setText(getMessages().getMessage("sendTrackToContact.question"));
   }
   return questionLabel;
 }
 private JLabel getMessageLabel() {
   if (messageLabel == null) {
     messageLabel = new JLabel();
     messageLabel.setText("JLabel");
     messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
     messageLabel.setHorizontalTextPosition(SwingConstants.CENTER);
     messageLabel.setBounds(new Rectangle(0, 20, 324, 12));
     messageLabel.setText(getMessages().getMessage("sendTrackToContact.message"));
   }
   return messageLabel;
 }
 private JLabel getContactLabel() {
   if (contactLabel == null) {
     contactLabel = new JLabel();
     contactLabel.setBounds(new Rectangle(0, 40, 324, 14));
     contactLabel.setHorizontalAlignment(SwingConstants.CENTER);
     contactLabel.setHorizontalTextPosition(SwingConstants.CENTER);
     contactLabel.setText(this.name);
     contactLabel.setName(SynthFonts.BOLD_ITALIC_FONT12_PURPLE32_0f_32);
   }
   return contactLabel;
 }
Beispiel #19
0
  public MovingPicture(String name) {
    JLabel label = new JLabel();
    ImageIcon icon = new ImageIcon("faces/" + name + "/profilePicture.jpg");
    label.setIcon(icon);
    label.setText("<html><h3>Hallo " + name + "</h3></html>");
    label.setHorizontalTextPosition(SwingConstants.CENTER);
    label.setVerticalTextPosition(SwingConstants.BOTTOM);
    add(label);
    pack();

    reset();
  }
  /**
   * This method initializes jContentPane
   *
   * @return javax.swing.JPanel
   */
  private JPanel getJContentPane() {
    if (jContentPane == null) {
      jLabelErro = new JLabel();
      jLabelErro.setBounds(new Rectangle(5, 8, 271, 39));
      jLabelErro.setHorizontalAlignment(SwingConstants.CENTER);
      jLabelErro.setHorizontalTextPosition(SwingConstants.CENTER);
      jLabelErro.setText(content1);

      jLabelError = new JLabel();
      jLabelError.setBounds(new Rectangle(8, 51, 268, 32));
      jLabelError.setHorizontalAlignment(SwingConstants.CENTER);
      jLabelError.setHorizontalTextPosition(SwingConstants.CENTER);
      jLabelError.setText(content2);

      jContentPane = new JPanel();
      jContentPane.setLayout(null);
      jContentPane.add(jLabelError);
      jContentPane.add(getJButtonOK(), null);
      jContentPane.add(jLabelErro, null);
    }
    return jContentPane;
  }
Beispiel #21
0
 public java.awt.Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   java.awt.Component c =
       tableCellRenderer.getTableCellRendererComponent(
           table, value, isSelected, hasFocus, row, column);
   if (c instanceof JLabel) {
     JLabel l = (JLabel) c;
     l.setHorizontalTextPosition(JLabel.LEFT);
     int modelColumn = table.convertColumnIndexToModel(column);
     l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
   }
   return c;
 }
Beispiel #22
0
  /** Create the frame */
  public DateTimer() {
    super();
    setTitle("v14 CountDown");
    getContentPane().setLayout(null);
    setBounds(100, 100, 500, 375);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final JLabel finishtimeLabel = new JLabel();
    finishtimeLabel.setText("CountDown Time");
    finishtimeLabel.setBounds(10, 36, 119, 15);
    getContentPane().add(finishtimeLabel);
    finishtime =
        new JFormattedTextField(
            new DateFormatter(new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa", Locale.ENGLISH)));
    finishtime.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {}
        });

    finishtime.setValue(new Date());
    finishtime.setBounds(135, 34, 187, 19);
    getContentPane().add(finishtime);

    final JButton startButton = new JButton();
    startButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            startCount();
          }
        });
    startButton.setText("Start!!!");
    startButton.setBounds(334, 31, 111, 25);
    getContentPane().add(startButton);

    countLabel = new JLabel();
    countLabel.setHorizontalAlignment(SwingConstants.CENTER);
    countLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    countLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 14));
    countLabel.setBorder(new LineBorder(Color.black, 1, false));
    countLabel.setText("Countdown not Started");
    countLabel.setBounds(10, 162, 435, 47);
    getContentPane().add(countLabel);

    final JLabel credits = new JLabel();
    credits.setHorizontalAlignment(SwingConstants.RIGHT);
    credits.setText("");
    credits.setBounds(253, 328, 237, 15);
    getContentPane().add(credits);
  }
    public StatRow(String desc, String race, boolean male, String name, int score) {
      this.desc = desc;
      this.race = race;
      this.male = male;
      this.name = name;
      this.score = score;

      descLbl = new JLabel(desc);
      nameLbl = new JLabel();
      nameLbl.setHorizontalTextPosition(SwingConstants.RIGHT);
      scoreLbl = new JLabel(Integer.toString(score));
      editBtn = new JButton("Edit");
      editBtn.setMargin(new Insets(0, 0, 0, 0));
    }
Beispiel #24
0
  public Newspaper() {
    // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Newspaper");
    getContentPane().setBackground(new Color(251, 236, 175));

    // A label for displaying the pictures
    photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
    photographLabel.setHorizontalTextPosition(JLabel.CENTER);
    photographLabel.setHorizontalAlignment(JLabel.CENTER);
    photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // A label for Displaying the news
    // theLabel.setVerticalTextPosition(JLabel.BOTTOM);
    // theLabel.setHorizontalTextPosition(JLabel.CENTER);
    // theLabel.setHorizontalAlignment(JLabel.CENTER);
    theLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    theLabel.setContentType("text/html");
    theLabel.setEditable(false);

    JScrollPane scrollPane = new JScrollPane(theLabel);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    // We add two glue components. Later in process() we will add thumbnail buttons
    // to the toolbar inbetween thease glue compoents. This will center the
    // buttons in the toolbar.
    buttonBar.add(Box.createGlue());
    buttonBar.add(Box.createGlue());
    buttonBar.setBackground(new Color(251, 236, 175));
    // buttonBar.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

    add(buttonBar, BorderLayout.SOUTH);
    add(photographLabel, BorderLayout.NORTH);
    add(scrollPane, BorderLayout.CENTER);

    Icon header =
        createImageIcon(
            "Resources/Image/newspaper/header.gif", "Blackwood Times : Weekly Newspaper");
    photographLabel.setIcon(header);

    setSize(700, 525);

    // this centers the frame on the screen
    setLocationRelativeTo(null);

    // start the image loading SwingWorker in a background thread
    loadimages.execute();
  }
Beispiel #25
0
  private MainPanel() {
    super();

    JLabel label = new JLabel(new DragHereIcon());
    label.setText("<html>Drag <b>Files</b> Here");
    label.setVerticalTextPosition(SwingConstants.BOTTOM);
    label.setHorizontalTextPosition(SwingConstants.CENTER);
    label.setForeground(Color.GRAY);
    label.setFont(new Font(Font.SERIF, Font.PLAIN, 24));

    label.setDropTarget(
        new DropTarget(label, DnDConstants.ACTION_COPY, new FileDropTargetAdapter(), true));
    // Test: label.setTransferHandler(new FileTransferHandler());

    add(label);
    setPreferredSize(new Dimension(320, 240));
  }
Beispiel #26
0
  public JlabelDemo() {
    ImageIcon icon = new ImageIcon("java-swing-tutorial.JPG", "My Website");
    // Creating an Icon
    setLayout(new GridLayout(3, 1));
    // 3 rows, 1 column Panel having Grid Layout
    jlbLabel1 = new JLabel("Image with Text", icon, JLabel.CENTER);
    // We can position of the text, relative to the icon:
    jlbLabel1.setVerticalTextPosition(JLabel.BOTTOM);

    jlbLabel1.setHorizontalTextPosition(JLabel.CENTER);
    jlbLabel2 = new JLabel("Text Only Label");
    jlbLabel3 = new JLabel(icon); // Label of Icon Only
    // Add labels to the Panel
    add(jlbLabel1);
    add(jlbLabel2);
    add(jlbLabel3);
  }
Beispiel #27
0
 private void preinitGUI() {
   try {
     setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
     this.setResizable(false);
     {
       titleLabel = new JLabel();
       getContentPane().add(titleLabel, BorderLayout.NORTH);
       titleLabel.setFont(new java.awt.Font("Segoe UI", 1, 20));
       titleLabel.setPreferredSize(new java.awt.Dimension(434, 62));
       titleLabel.setHorizontalTextPosition(SwingConstants.CENTER);
       titleLabel.setText("TITOLO");
     }
     {
       buttonContainer = new JPanel();
       FlowLayout buttonContainerLayout = new FlowLayout();
       buttonContainerLayout.setAlignment(FlowLayout.RIGHT);
       buttonContainer.setLayout(buttonContainerLayout);
       getContentPane().add(buttonContainer, BorderLayout.SOUTH);
       {
         cancelButton = new JButton();
         buttonContainer.add(cancelButton);
         cancelButton.setText("Annulla");
         cancelButton.addActionListener(this);
       }
       {
         okButton = new JButton();
         buttonContainer.add(okButton);
         okButton.setText("Ok");
         okButton.addActionListener(this);
       }
     }
     {
       contentPanel = new JPanel();
       GridLayout contentPanelLayout = new GridLayout(1, 1);
       contentPanelLayout.setColumns(1);
       contentPanelLayout.setHgap(5);
       contentPanelLayout.setVgap(5);
       contentPanel.setLayout(contentPanelLayout);
       getContentPane().add(contentPanel, BorderLayout.CENTER);
       contentPanel.setPreferredSize(new java.awt.Dimension(434, 236));
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
    @Override
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

      VillainCard card = (VillainCard) value;

      JLabel label =
          (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
      label.setIcon(new ImageIcon(getImageSummary(card)));
      label.setHorizontalTextPosition(JLabel.RIGHT);
      String s = card.name + " (" + card.villainGroup + ")";
      if (card.changed) {
        s += " *";
      }
      label.setText(s);

      return label;
    }
Beispiel #29
0
  /** Render table header */
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

    Component result =
        superRenderer.getTableCellRendererComponent(
            table, value, isSelected, hasFocus, row, column);

    if (result instanceof JLabel) {
      final JLabel label = (JLabel) result;
      label.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);

      final int columnModel = table.convertColumnIndexToModel(column);
      final Key colProperty = ((UjoTable) table).getModel().getColumn(columnModel);
      label.setIcon(colProperty == sortedColumn ? sortIcon : null);
    }

    return result;
  }
Beispiel #30
0
  protected JPanel getTopBanner() {
    if (topBanner == null) {
      topBanner = new ImagePanel(UIImages.ABOUT_DIALOG_TOP_BANNER_IMG.getImage(), Style.FIT_PANEL);
      topBanner.setLayout(new GridBagLayout());
      GridBagConstraints gc = new GridBagConstraints();
      gc.insets = new Insets(2, 2, 2, 2);
      gc.weightx = 1;
      gc.weighty = 1;
      gc.gridwidth = GridBagConstraints.REMAINDER;
      gc.fill = GridBagConstraints.BOTH;
      appNameLabel = new JLabel(UILabels.STL91000_ABOUT_APP.getDescription(appNameStr, appVersion));
      appNameLabel.setFont(UIConstants.H2_FONT.deriveFont(Font.BOLD));
      appNameLabel.setForeground(UIConstants.INTEL_WHITE);
      appNameLabel.setHorizontalAlignment(JLabel.CENTER);
      appNameLabel.setVerticalAlignment(JLabel.CENTER);
      appNameLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
      topBanner.add(appNameLabel, gc);

      gc.weightx = 0;
      gc.weighty = 0;
      gc.gridwidth = 1;
      appBuildIdLabel = new JLabel(UILabels.STL91001_BUILD_ID.getDescription(appBuildIdStr));
      /*-
       * We are now constructing the version number using the BuildId
      appBuildIdLabel.setFont(UIConstants.H5_FONT);
      appBuildIdLabel.setForeground(UIConstants.INTEL_WHITE);
      appBuildIdLabel.setHorizontalTextPosition(JLabel.LEADING);
      topBanner.add(appBuildIdLabel, gc);
       */

      gc.weightx = 1;
      topBanner.add(Box.createGlue(), gc);

      gc.weightx = 0;
      gc.gridwidth = GridBagConstraints.REMAINDER;
      appBuildDateLabel = new JLabel(UILabels.STL91002_BUILD_DATE.getDescription(appBuildDateStr));
      appBuildDateLabel.setFont(UIConstants.H5_FONT);
      appBuildDateLabel.setForeground(UIConstants.INTEL_WHITE);
      appBuildDateLabel.setHorizontalTextPosition(JLabel.LEADING);
      topBanner.add(appBuildDateLabel, gc);
    }
    return topBanner;
  }