コード例 #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 setShowBorder(boolean isSelected) {
   if (isSelected) {
     borderBtn.setIcon(UIImages.SHOW_BORDER.getImageIcon());
     borderBtn.setText(STLConstants.K0530_SHOW_BORDER.getValue());
   } else {
     borderBtn.setIcon(UIImages.HIDE_BORDER.getImageIcon());
     borderBtn.setText(STLConstants.K0531_HIDE_BORDER.getValue());
   }
 }