javax.swing.JToolBar.getUI()方法的使用及代码示例

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

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

JToolBar.getUI介绍

暂无

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void actionPerformed(ActionEvent e)
  {
    JToolBar toolBar= (JToolBar) e.getSource();
    ToolBarUI ui= (ToolBarUI) toolBar.getUI();
    ui.navigateFocusedComp(EAST);
  }
};

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void actionPerformed(ActionEvent e)
  {
    JToolBar toolBar= (JToolBar) e.getSource();
    ToolBarUI ui= (ToolBarUI) toolBar.getUI();
    ui.navigateFocusedComp(SOUTH);
  }
};

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void actionPerformed(ActionEvent e)
  {
    JToolBar toolBar= (JToolBar) e.getSource();
    ToolBarUI ui= (ToolBarUI) toolBar.getUI();
    ui.navigateFocusedComp(WEST);
  }
};

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void actionPerformed(ActionEvent e)
  {
    JToolBar toolBar= (JToolBar) e.getSource();
    ToolBarUI ui= (ToolBarUI) toolBar.getUI();
    ui.navigateFocusedComp(NORTH);
  }
};

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
public void ancestorMoved(AncestorEvent event) {
  if (toolbar.getUI() instanceof BasicToolBarUI) {
    if (((BasicToolBarUI) toolbar.getUI()).isFloating()) {
      locationChanged();
    }
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
  public void ancestorRemoved(AncestorEvent event) {
    if (toolbar.getUI() instanceof BasicToolBarUI) {
      if (((BasicToolBarUI) toolbar.getUI()).isFloating()) {
        locationChanged();
      }
    }
  }
}

代码示例来源:origin: abbot/abbot

/** @return whether the bar is currently floating. */
public boolean isFloating(JToolBar bar) {
  ToolBarUI ui = bar.getUI();
  if (ui instanceof BasicToolBarUI)
    return ((BasicToolBarUI)ui).isFloating();
  // Have to guess; probably ought to check for sibling components
  Window w = SwingUtilities.getWindowAncestor(bar);
  return !(w instanceof Frame)
    && bar.getParent().getComponentCount() == 1;
}
/** Drag the tool bar to the given location, causing it to float.

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInCurrentThread
static boolean isJToolBarFloating(@Nonnull JToolBar toolBar) {
 ToolBarUI ui = toolBar.getUI();
 if (ui instanceof BasicToolBarUI) {
  return ((BasicToolBarUI) ui).isFloating();
 }
 // Have to guess; probably ought to check for sibling components
 Window w = getWindowAncestor(toolBar);
 return !(w instanceof Frame) && toolBar.getParent().getComponentCount() == 1;
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

Class<?> uiClazz = toolBar.getUI().getClass();
ClassLoader cl = uiClazz.getClassLoader();
  Method m = uiClazz.getDeclaredMethod(
      "setUndecorated", boolean.class);
  m.invoke(toolBar.getUI(), true);
  Field f = styleClazz.getDeclaredField("attached");
  Object style = f.get(null);
  m.invoke(toolBar.getUI(), style);

代码示例来源:origin: abbot/abbot

Class cls = bar.getUI().getClass();
if (bar.getUI() instanceof BasicToolBarUI) {
  cls = BasicToolBarUI.class;
  Field f = cls.getDeclaredField("dockingSource");
  f.setAccessible(true);
  dock = (Container)f.get(bar.getUI());

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

class ExitAction extends AbstractAction {
  public ExitAction() {
    super("Exit");
  }
  @Override public void actionPerformed(ActionEvent e) {
    JComponent c = (JComponent) e.getSource();
    Window window = null;
    Container parent = c.getParent();
    if (parent instanceof JPopupMenu) {
      JPopupMenu popup = (JPopupMenu) parent;
      JComponent invoker = (JComponent) popup.getInvoker();
      window = SwingUtilities.getWindowAncestor(invoker);
    } else if (parent instanceof JToolBar) {
      JToolBar toolbar = (JToolBar) parent;
      if (((BasicToolBarUI) toolbar.getUI()).isFloating()) {
        window = SwingUtilities.getWindowAncestor(toolbar).getOwner();
      } else {
        window = SwingUtilities.getWindowAncestor(toolbar);
      }
    } else {
      Component invoker = c.getParent();
      window = SwingUtilities.getWindowAncestor(invoker);
    }
    if (window != null) {
      //window.dispose();
      window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
    }
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
if ((component instanceof JToolBar) && ((((JToolBar) component).getUI()) instanceof PaletteToolBarUI)) {
  JToolBar c = (JToolBar) component;
  if (c.isFloatable()) {

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInCurrentThread
@Nonnull private static Container dockFor(final @Nonnull JToolBar toolBar) {
 try {
  return checkNotNull(field("dockingSource").ofType(Container.class).in(toolBar.getUI()).get());
 } catch (RuntimeException e) {
  throw actionFailure("Unabled to determine dock for JToolBar");
 }
}

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

tbFile = new JToolBar();
 final HierarchyListener hierarchyListener = new HierarchyListener() {
   @Override
   public void hierarchyChanged(HierarchyEvent e) {
     if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) == 0) return;
     JToolBar bar = (JToolBar) e.getComponent();
     if (!((BasicToolBarUI) bar.getUI()).isFloating()) return;
     Window topLevel = SwingUtilities.windowForComponent(bar);
     if(topLevel == null) return;
     topLevel.dispose();
     ((JDialog) topLevel).setUndecorated(true);
     topLevel.setVisible(true);
   }
 };
 tbFile.addHierarchyListener(hierarchyListener);

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

tb.add(new JButton("AAAAA"));
tb.setBackground(Color.GREEN);
ui = (BasicToolBarUI) tb.getUI();

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
  public void actionPerformed(ActionEvent evt) {
    String key = getName();
    JToolBar toolBar = (JToolBar) evt.getSource();
    PaletteToolBarUI ui = (PaletteToolBarUI) PaletteLookAndFeel.getUIOfType(
        toolBar.getUI(), PaletteToolBarUI.class);
    if (NAVIGATE_RIGHT == key) {
      ui.navigateFocusedComp(EAST);
    } else if (NAVIGATE_LEFT == key) {
      ui.navigateFocusedComp(WEST);
    } else if (NAVIGATE_UP == key) {
      ui.navigateFocusedComp(NORTH);
    } else if (NAVIGATE_DOWN == key) {
      ui.navigateFocusedComp(SOUTH);
    }
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

private void locationChanged() {
  if (toolbar.getUI() instanceof BasicToolBarUI) {
    BasicToolBarUI ui = (BasicToolBarUI) toolbar.getUI();
    boolean floating = ui.isFloating();
    prefs.putBoolean(prefsPrefix+".isFloating", floating);

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

public static void configuraWeblaf(JToolBar barraDeFerramentas) {
  if (!WeblafUtils.weblafEstaInstalado()) {
    return;
  }
  ((WebToolBarUI) barraDeFerramentas.getUI()).setUndecorated(true);
  for (int i = 0; i < barraDeFerramentas.getComponentCount(); i++) {
    Component componente = barraDeFerramentas.getComponent(i);
    if (componente instanceof AbstractButton) {
      AbstractButton botao = (AbstractButton) barraDeFerramentas.getComponent(i);
      ((WebButtonUI) botao.getUI()).setRolloverDecoratedOnly(true);
    }
  }
}

相关文章

JToolBar类方法