Пример #1
0
 public void propertyChange(PropertyChangeEvent e) {
   if (e.getSource() instanceof PanelThreadMonitor) {
     if (e.getPropertyName().equals("Status")) {
       PanelThreadMonitor mntTmp = (PanelThreadMonitor) e.getSource();
       int iMonitorIndex = pnlThread.indexOfComponent(mntTmp);
       if (iMonitorIndex >= 0) {
         if (e.getNewValue().equals("Started")) {
           if (!pnlThread.getBackgroundAt(iMonitorIndex).equals(COLOR_STARTED)) {
             pnlThread.setBackgroundAt(iMonitorIndex, COLOR_STARTED);
             pnlThread.setForegroundAt(iMonitorIndex, COLOR_STARTED_FG);
           }
         } else if (e.getNewValue().equals("Stopped")) {
           if (!pnlThread.getBackgroundAt(iMonitorIndex).equals(SystemColor.controlShadow)) {
             pnlThread.setBackgroundAt(iMonitorIndex, UIManager.getColor("TabbedPane.background"));
             pnlThread.setForegroundAt(iMonitorIndex, SystemColor.textText);
           }
         }
       }
     }
   }
 }
Пример #2
0
  private static void setupTabbedPane(JTabbedPane tabbedPane) {
    // Simple tab
    tabbedPane.addTab("Normal 1", new WebLabel());

    // Disabled tab
    tabbedPane.addTab("Disabled 2", new WebLabel());
    tabbedPane.setEnabledAt(1, false);

    // Selected tab
    tabbedPane.addTab("Selected 3", new WebLabel());
    tabbedPane.setSelectedIndex(2);

    // Colored tab
    tabbedPane.addTab("Colored 4", new WebLabel());
    tabbedPane.setBackgroundAt(3, new Color(255, 212, 161));
  }