コード例 #1
0
  protected void addStyleButtons() {
    borderBtn =
        new JButton(STLConstants.K0530_SHOW_BORDER.getValue(), UIImages.HIDE_BORDER.getImageIcon());
    borderBtn.setOpaque(false);
    borderBtn.setFocusable(false);
    borderBtn.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            boolean isSelected = borderBtn.getIcon() != UIImages.SHOW_BORDER.getImageIcon();
            setShowBorder(isSelected);
            if (listener != null) {
              listener.onShowBorder(isSelected);
            }
          }
        });
    toolBar.add(borderBtn);

    alternationBtn =
        new JButton(STLConstants.K0533_UNI_ROWS.getValue(), UIImages.UNI_ROWS.getImageIcon());
    alternationBtn.setOpaque(false);
    alternationBtn.setFocusable(false);
    alternationBtn.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            boolean isSelected = alternationBtn.getIcon() != UIImages.ALT_ROWS.getImageIcon();
            setShowAlternation(isSelected);
            if (listener != null) {
              listener.onShowAlternation(isSelected);
            }
          }
        });
    toolBar.add(alternationBtn);
  }
コード例 #2
0
 protected void setShowAlternation(boolean isSelected) {
   if (isSelected) {
     alternationBtn.setIcon(UIImages.ALT_ROWS.getImageIcon());
     alternationBtn.setText(STLConstants.K0532_ALT_ROWS.getValue());
   } else {
     alternationBtn.setIcon(UIImages.UNI_ROWS.getImageIcon());
     alternationBtn.setText(STLConstants.K0533_UNI_ROWS.getValue());
   }
 }