本文整理匯總了Java中javax.swing.JToolBar.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java JToolBar.remove方法的具體用法?Java JToolBar.remove怎麽用?Java JToolBar.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JToolBar
的用法示例。
在下文中一共展示了JToolBar.remove方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: stealJToolBarFromOntologyClassEditorJPanel
import javax.swing.JToolBar; //導入方法依賴的package包/類
/**
* Steal the components of a JToolBar for a {@link OntologyClassEditorJPanel}.
* @param ocep the OntologyClassEditorJPanel
*/
private void stealJToolBarFromOntologyClassEditorJPanel(OntologyClassEditorJPanel ocep) {
if (ocep==null) return;
if (this.jToolBar4UserFunction==null) return;
JToolBar jToolBarUserFunctions = ocep.getJToolBarUserFunctions();
if (jToolBarUserFunctions!=null) {
Container containerUserFunctions = jToolBarUserFunctions.getParent();
while (jToolBarUserFunctions.getComponentCount()>0) {
Component comp = jToolBarUserFunctions.getComponent(0);
this.getStolenComponentsFromJToolBarOfOntologyClassEditorJPanel().add(comp);
jToolBarUserFunctions.remove(comp);
}
if (containerUserFunctions!=null) {
containerUserFunctions.remove(jToolBarUserFunctions);
}
ocep.validate();
ocep.repaint();
}
}
示例2: fixSize
import javax.swing.JToolBar; //導入方法依賴的package包/類
private void fixSize(JToolBar actionBar) {
Insets ins = actionBar.getMargin();
JButton dummy = new JButton();
dummy.setBorderPainted(false);
dummy.setOpaque(false);
dummy.setText(null);
dummy.setIcon(new Icon() {
@Override
public int getIconHeight() {
return 16;
}
@Override
public int getIconWidth() {
return 16;
}
@SuppressWarnings(value = "empty-statement")
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
;
}
});
actionBar.add(dummy);
Dimension buttonPref = dummy.getPreferredSize();
Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom);
actionBar.setMinimumSize(minDim);
actionBar.setPreferredSize(minDim);
actionBar.remove(dummy);
}