javax.swing.JTabbedPane.setBackgroundAt()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中javax.swing.JTabbedPane.setBackgroundAt()方法的一些代码示例,展示了JTabbedPane.setBackgroundAt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTabbedPane.setBackgroundAt()方法的具体详情如下:
包路径:javax.swing.JTabbedPane
类名称:JTabbedPane
方法名:setBackgroundAt

JTabbedPane.setBackgroundAt介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

jtp.setBackgroundAt(0, Color.RED);
  jtp.addTab("Greens", new ColorPanel(1, Color.GREEN));
  jtp.setBackgroundAt(1, Color.GREEN);
  jtp.addTab("Blues", new ColorPanel(2, Color.BLUE));
  jtp.setBackgroundAt(2, Color.BLUE);
color = new Color(rnd.nextInt() & mask);
this.setBackground(color);
jtp.setBackgroundAt(index, original);

代码示例来源:origin: stackoverflow.com

Color color = Color.getHSBColor((float) i / MAX, 1, 1);
pane.add("Tab " + String.valueOf(i), new TabContent(i, color));
pane.setBackgroundAt(i, color);

代码示例来源:origin: fcrepo3/fcrepo

@Override
public void colorTabForState(String id, String s) {
  int i = getTabIndex(id);
  if (s.equals("I")) {
    m_tabbedPane.setBackgroundAt(i, Administrator.INACTIVE_COLOR);
  } else if (s.equals("D")) {
    m_tabbedPane.setBackgroundAt(i, Administrator.DELETED_COLOR);
  } else {
    m_tabbedPane.setBackgroundAt(i, Administrator.ACTIVE_COLOR);
  }
}

代码示例来源:origin: LibraryOfCongress/bagger

@Override
 public void stateChanged(ChangeEvent changeEvent) {
  JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
  int count = sourceTabbedPane.getTabCount();
  int selected = sourceTabbedPane.getSelectedIndex();
  for (int i = 0; i < count; ++i) {
   Color c = (i == selected) ? unselectedColor : selectedColor;
   sourceTabbedPane.setBackgroundAt(i, c);
   sourceTabbedPane.setForegroundAt(i, c);
  }
 }
};

代码示例来源:origin: net.sf.taverna.t2.ui-impl/zaria

public void actionPerformed(ActionEvent arg0) {
  int i = tabs.getSelectedIndex();
  Color c = tabs.getBackgroundAt(i);
  Color newColour = JColorChooser.showDialog(ZTabbedPane.this,
      "Pick tab colour", c);
  if (newColour != null) {
    tabs.setBackgroundAt(i, newColour);
  }
}

代码示例来源:origin: PortSwigger/replicator

public void stateChanged(ChangeEvent e) {
    if(tabbedPane.getSelectedComponent() == ReplicatorPanel.this)
    {
      tabbedPane.setBackgroundAt(tabbedPane.getSelectedIndex(), Color.BLACK);
      optionsPanel.loadMacros();
    }
  }
};

代码示例来源:origin: xyz.cofe/gui.swing

@Override
public void setBackgroundAt(int index, Color background) {
  Component cmpt = this.getTabComponentAt(index);
  if( cmpt instanceof TabQuery )((TabQuery)cmpt).setTabBackground(background);
  super.setBackgroundAt(index, background);
}

代码示例来源:origin: PortSwigger/replicator

@Override
  public void actionPerformed(ActionEvent e)
  {
    for(int j = 0; j < tabbedPane.getTabCount(); j++)
    {
      if (tabbedPane.getComponentAt(j) == ReplicatorPanel.this)
      {
        tabbedPane.setBackgroundAt(j, Color.BLACK);
        break;
      }
    }
  }
});

代码示例来源:origin: nccgroup/AutoRepeater

public static void highlightTab() {
 if (parentTabbedPane != null) {
  for (int i = 0; i < parentTabbedPane.getTabCount(); i++) {
   if (parentTabbedPane.getComponentAt(i).equals(mainTabbedPane)) {
    parentTabbedPane.setBackgroundAt(i, Utils.getBurpOrange());
    Timer timer = new Timer(3000, e -> {
     for (int j = 0; j < parentTabbedPane.getTabCount(); j++) {
      if (parentTabbedPane.getComponentAt(j).equals(mainTabbedPane)) {
       parentTabbedPane.setBackgroundAt(j, Color.BLACK);
       break;
      }
     }
    });
    timer.setRepeats(false);
    timer.start();
    break;
   }
  }
 }
}

代码示例来源:origin: nccgroup/AutoRepeater

public static void highlightParentTab(JTabbedPane parentTabbedPane, Component childComponent) {
  if (parentTabbedPane != null) {
   for (int i = 0; i < parentTabbedPane.getTabCount(); i++) {
    if (parentTabbedPane.getComponentAt(i).equals(childComponent)) {
     parentTabbedPane.setBackgroundAt(i, getBurpOrange());
     Timer timer = new Timer(3000, e -> {
      for (int j = 0; j < parentTabbedPane.getTabCount(); j++) {
       if (parentTabbedPane.getComponentAt(j).equals(childComponent)) {
        parentTabbedPane.setBackgroundAt(j, Color.BLACK);
        break;
       }
      }
     });
     timer.setRepeats(false);
     timer.start();
     break;
    }
   }
  }
 }
}

代码示例来源:origin: PortSwigger/replicator

tabbedPane.setBackgroundAt(i, new Color(0xff6633));
Timer timer = new Timer(3000, new ActionListener()

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing

@Override
  public void propertyChange(PropertyChangeEvent e) {
    String name = e.getPropertyName();
    if (name.equals(TabInfo.TITLE_PROPERTY)) {
      tabs.setTitleAt(tabIndex, (String) e.getNewValue());
    } else if (name.equals(TabInfo.TOOL_TIP_TEXT_PROPERTY)) {
      tabs.setToolTipTextAt(tabIndex, (String) e.getNewValue());
    } else if (name.equals(TabInfo.FOREGROUND_PROPERTY)) {
      tabs.setForegroundAt(tabIndex, (Color) e.getNewValue());
    } else if (name.equals(TabInfo.BACKGROUND_PROPERTY)) {
      tabs.setBackgroundAt(tabIndex, (Color) e.getNewValue());
    } else if (name.equals(TabInfo.MNEMONIC_PROPERTY)) {
      tabs.setMnemonicAt(tabIndex, (Integer) e.getNewValue());
    } else if (name.equals(TabInfo.DISPLAYED_MNEMONIC_INDEX_PROPERTY)) {
      tabs.setDisplayedMnemonicIndexAt(tabIndex, (Integer) e.getNewValue());
    } else if (name.equals(TabInfo.ICON_PROPERTY)) {
      tabs.setIconAt(tabIndex, (Icon) e.getNewValue());
    } else if (name.equals(TabInfo.DISABLED_ICON_PROPERTY)) {
      tabs.setDisabledIconAt(tabIndex, (Icon) e.getNewValue());
    }
  }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime

@Override
  public void propertyChange(PropertyChangeEvent e) {
    String name = e.getPropertyName();
    if (name.equals(TabInfo.TITLE_PROPERTY)) {
      tabs.setTitleAt(tabIndex, (String) e.getNewValue());
    } else if (name.equals(TabInfo.TOOL_TIP_TEXT_PROPERTY)) {
      tabs.setToolTipTextAt(tabIndex, (String) e.getNewValue());
    } else if (name.equals(TabInfo.FOREGROUND_PROPERTY)) {
      tabs.setForegroundAt(tabIndex, (Color) e.getNewValue());
    } else if (name.equals(TabInfo.BACKGROUND_PROPERTY)) {
      tabs.setBackgroundAt(tabIndex, (Color) e.getNewValue());
    } else if (name.equals(TabInfo.MNEMONIC_PROPERTY)) {
      tabs.setMnemonicAt(tabIndex, (Integer) e.getNewValue());
    } else if (name.equals(TabInfo.DISPLAYED_MNEMONIC_INDEX_PROPERTY)) {
      tabs.setDisplayedMnemonicIndexAt(tabIndex, (Integer) e.getNewValue());
    } else if (name.equals(TabInfo.ICON_PROPERTY)) {
      tabs.setIconAt(tabIndex, (Icon) e.getNewValue());
    } else if (name.equals(TabInfo.DISABLED_ICON_PROPERTY)) {
      tabs.setDisabledIconAt(tabIndex, (Icon) e.getNewValue());
    } else if (name.equals(TabInfo.TAB_COMPONENT_PROPERTY)) {
      tabs.setTabComponentAt(tabIndex, (Component) e.getNewValue());
    } else if (name.equals(TabInfo.ENABLED_PROPERTY)) {
      tabs.setEnabledAt(tabIndex, (Boolean) e.getNewValue());
    }
  }
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime

@Override
  public void propertyChange(PropertyChangeEvent e) {
    String name = e.getPropertyName();
    if (name.equals(TabInfo.TITLE_PROPERTY)) {
      tabs.setTitleAt(tabIndex, (String) e.getNewValue());
    } else if (name.equals(TabInfo.TOOL_TIP_TEXT_PROPERTY)) {
      tabs.setToolTipTextAt(tabIndex, (String) e.getNewValue());
    } else if (name.equals(TabInfo.FOREGROUND_PROPERTY)) {
      tabs.setForegroundAt(tabIndex, (Color) e.getNewValue());
    } else if (name.equals(TabInfo.BACKGROUND_PROPERTY)) {
      tabs.setBackgroundAt(tabIndex, (Color) e.getNewValue());
    } else if (name.equals(TabInfo.MNEMONIC_PROPERTY)) {
      tabs.setMnemonicAt(tabIndex, (Integer) e.getNewValue());
    } else if (name.equals(TabInfo.DISPLAYED_MNEMONIC_INDEX_PROPERTY)) {
      tabs.setDisplayedMnemonicIndexAt(tabIndex, (Integer) e.getNewValue());
    } else if (name.equals(TabInfo.ICON_PROPERTY)) {
      tabs.setIconAt(tabIndex, (Icon) e.getNewValue());
    } else if (name.equals(TabInfo.DISABLED_ICON_PROPERTY)) {
      tabs.setDisabledIconAt(tabIndex, (Icon) e.getNewValue());
    } else if (name.equals(TabInfo.TAB_COMPONENT_PROPERTY)) {
      tabs.setTabComponentAt(tabIndex, (Component) e.getNewValue());
    } else if (name.equals(TabInfo.ENABLED_PROPERTY)) {
      tabs.setEnabledAt(tabIndex, (Boolean) e.getNewValue());
    }
  }
}

代码示例来源:origin: stackoverflow.com

pane.setBackgroundAt(0, Color.RED);
pane.setBackgroundAt(1, Color.GREEN);
pane.setBackgroundAt(2, Color.YELLOW);
pane.setBackgroundAt(3, Color.ORANGE);

代码示例来源:origin: stackoverflow.com

if (blinkFlag) {
  pane.setForegroundAt(1, Color.green);
  pane.setBackgroundAt(1, Color.orange);
} else {
  pane.setForegroundAt(1, defaultForeColor);
  pane.setBackgroundAt(1, defaultBackColor);

代码示例来源:origin: fcrepo3/fcrepo

/**
 * Set the content of the "New..." JPanel to a fresh new datastream entry
 * panel, and switch to it, if needed.
 */
public void doNew(String[] dropdownMimeTypes, boolean makeSelected) {
  int i = getTabIndex("New...");
  m_tabbedPane
      .setComponentAt(i, new NewDatastreamPane(dropdownMimeTypes));
  i = getTabIndex("New...");
  m_tabbedPane.setToolTipTextAt(i, "Add a new datastream to this object");
  m_tabbedPane.setIconAt(i, newIcon);
  m_tabbedPane.setBackgroundAt(i, Administrator.DEFAULT_COLOR);
  if (makeSelected) {
    m_tabbedPane.setSelectedIndex(i);
  }
}

代码示例来源:origin: org.biojava.thirdparty/forester

@Override
  public void stateChanged( final ChangeEvent evt ) {
    final JTabbedPane pane = ( JTabbedPane ) evt.getSource();
    getControlPanel().tabChanged();
    // Get current tab
    final int sel = pane.getSelectedIndex();
    if ( sel >= 0 ) {
      if ( !getConfiguration().isUseNativeUI() ) {
        if ( _tabbed_pane.getTabCount() > 0 ) {
          _tabbed_pane.setForegroundAt( sel, Constants.TAB_LABEL_FOREGROUND_COLOR_SELECTED );
          for( int i = 0; i < _tabbed_pane.getTabCount(); ++i ) {
            if ( i != sel ) {
              _tabbed_pane.setBackgroundAt( i, getConfiguration().getGuiBackgroundColor() );
              _tabbed_pane.setForegroundAt( i, getConfiguration().getGuiCheckboxTextColor() );
            }
          }
        }
      }
    }
  }
} );

代码示例来源:origin: fcrepo3/fcrepo

/**
 * Set the content of the "New Rels-Ext..." JPanel to a fresh new datastream
 * entry panel, and switch to it, if needed.
 *
 * @throws Exception
 */
public void updateNewRelsExt(String pid) throws Exception {
  if (!hasRelsExt() && getTabIndex("New RELS-EXT...") == -1) {
    m_tabbedPane.insertTab("New RELS-EXT...",
                newIcon,
                new NewRelsExtDatastreamPane(m_owner,
                              pid,
                              this),
                "Add a RELS-EXT datastream to this object",
                getTabIndex("New..."));
    int i = getTabIndex("New RELS-EXT...");
    m_tabbedPane.setBackgroundAt(i, Administrator.DEFAULT_COLOR);
  } else if (hasRelsExt() && getTabIndex("New RELS-EXT...") != -1) {
    m_tabbedPane.remove(getTabIndex("New RELS-EXT..."));
  }
}

代码示例来源:origin: org.xworker/xworker_core

parent.setBackgroundAt(index, background);

相关文章

JTabbedPane类方法