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

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

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

JTabbedPane.setTabLayoutPolicy介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

@PostConstruct
public void init() {
  tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
  tabbedPane.addChangeListener(new ChangeListener() {
    public void stateChanged(ChangeEvent evt) {
      Component comp = tabbedPane.getSelectedComponent();
      if (comp == null) return;
      for (Map.Entry<DeviceView, Component> entry : tabs.entrySet()) {
        if (entry.getValue().equals(comp)) {
          presenter.onDeviceViewChanged(entry.getKey());
          break;
        }
      }
    }
  });
  setLayout(new GridLayout(1, 1)); // Makes the tabs magically auto-fit in the parent container
  add(tabbedPane);
}

代码示例来源:origin: deathmarine/Luyten

public void run() {
    try {
      Thread.sleep(500);
      String internalName = FindBox.class.getName();
      TypeReference type = metadataSystem.lookupType(internalName);
      TypeDefinition resolvedType = null;
      if ((type == null) || ((resolvedType = type.resolve()) == null)) {
        return;
      }
      StringWriter stringwriter = new StringWriter();
      PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
      plainTextOutput
          .setUnicodeOutputEnabled(decompilationOptions.getSettings().isUnicodeOutputEnabled());
      settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
      String decompiledSource = stringwriter.toString();
      OpenFile open = new OpenFile(internalName, "*/" + internalName, getTheme(), mainWindow);
      open.setContent(decompiledSource);
      JTabbedPane pane = new JTabbedPane();
      pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
      pane.addTab("title", open.scrollPane);
      pane.setSelectedIndex(pane.indexOfTab("title"));
    } catch (Exception e) {
      Luyten.showExceptionDialog("Exception!", e);
    }
  }
}.start();

代码示例来源:origin: opentripplanner/OpenTripPlanner

tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

代码示例来源:origin: deathmarine/Luyten

house.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
house.addChangeListener(new TabChangeListener());
house.addMouseListener(new MouseAdapter() {

代码示例来源:origin: magefree/mage

tabsList.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);

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

final JTabbedPane tabs = new JTabbedPane();
tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); // ADD THIS!

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

public SquirrelTabbedPaneDelegate(SquirrelPreferences prefs, IApplication app, JTabbedPane tabbedPane)
{
 _tabbedPane = tabbedPane;
 if (prefs == null) { throw new IllegalArgumentException("SquirrelPreferences == null"); }
 _prefs = prefs;
 int tabLayoutPolicy =
    _prefs.getUseScrollableTabbedPanes() ? JTabbedPane.SCROLL_TAB_LAYOUT : JTabbedPane.WRAP_TAB_LAYOUT;
 _tabbedPane.setTabLayoutPolicy(tabLayoutPolicy);
}

代码示例来源:origin: org.orbisgis/orbisgis-view

@Override
public void addNotify() {
    super.addNotify();
    if(!initialised.getAndSet(true)) {
        //The following line enables to use scrolling tabs.
        tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    }
}

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

@Override
public void addNotify() {
    super.addNotify();
    if(!initialised.getAndSet(true)) {
        //The following line enables to use scrolling tabs.
        tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    }
}

代码示例来源:origin: realXuJiang/bigtable-sql

public SquirrelTabbedPaneDelegate(SquirrelPreferences prefs, IApplication app, JTabbedPane tabbedPane)
{
 _tabbedPane = tabbedPane;
 if (prefs == null) { throw new IllegalArgumentException("SquirrelPreferences == null"); }
 _prefs = prefs;
 int tabLayoutPolicy =
    _prefs.getUseScrollableTabbedPanes() ? JTabbedPane.SCROLL_TAB_LAYOUT : JTabbedPane.WRAP_TAB_LAYOUT;
 _tabbedPane.setTabLayoutPolicy(tabLayoutPolicy);
}

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

public void setTabLayoutPolicy(String type) {
  tabs.setTabLayoutPolicy(getTabLayoutPolicyValue(type));
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

void propertiesHaveChanged(String propName)
{
  JTabbedPane squirrelTabbedPane = _refSquirrelTabbedPane.get();
  if(null == squirrelTabbedPane)
  {
   return;
  }
  if (propName == null || propName.equals(IAppPrefPropertynames.SCROLLABLE_TABBED_PANES))
  {
   int tabLayoutPolicy =
      _prefs.getUseScrollableTabbedPanes() ? JTabbedPane.SCROLL_TAB_LAYOUT
         : JTabbedPane.WRAP_TAB_LAYOUT;
   squirrelTabbedPane.setTabLayoutPolicy(tabLayoutPolicy);
  }
}

代码示例来源:origin: realXuJiang/bigtable-sql

void propertiesHaveChanged(String propName)
{
  JTabbedPane squirrelTabbedPane = _refSquirrelTabbedPane.get();
  if(null == squirrelTabbedPane)
  {
   return;
  }
  if (propName == null || propName.equals(IAppPrefPropertynames.SCROLLABLE_TABBED_PANES))
  {
   int tabLayoutPolicy =
      _prefs.getUseScrollableTabbedPanes() ? JTabbedPane.SCROLL_TAB_LAYOUT
         : JTabbedPane.WRAP_TAB_LAYOUT;
   squirrelTabbedPane.setTabLayoutPolicy(tabLayoutPolicy);
  }
}

代码示例来源:origin: robo-code/robocode

private JTabbedPane getTabbedPane() {
  if (tabbedPane == null) {
    tabbedPane = new JTabbedPane();
    tabbedPane.setLayout(new BorderLayout());
    tabbedPane.addTab("Console", getConsoleScrollPane());
    tabbedPane.addTab("Turn Snapshot", getTurnSnapshotScrollPane());
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbedPane.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        paintSnapshot = (tabbedPane.getSelectedIndex() == 1);
        paintSnapshot();
      }
    });
  }
  return tabbedPane;
}

代码示例来源:origin: robo-code/robocode

private JTabbedPane getTabbedPane() {
  if (tabbedPane == null) {
    tabbedPane = new JTabbedPane();
    tabbedPane.setLayout(new BorderLayout());
    tabbedPane.addTab("Console", getConsoleScrollPane());
    tabbedPane.addTab("Properties", getPropertiesScrollPane());
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbedPane.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        printSnapshot = (tabbedPane.getSelectedIndex() == 1);
        printSnapshot();
      }
    });
  }
  return tabbedPane;
}

代码示例来源:origin: hyperion-project/hypercon

private JTabbedPane getSpecificationTabs() {
  if (mSpecificationTabs == null) {
    mSpecificationTabs = new JTabbedPane();
    mSpecificationTabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    
    mSpecificationTabs.addTab(language.getString("general.tab.hardware"), new JScrollPane(getHardwarePanel())); //$NON-NLS-1$
    mSpecificationTabs.addTab(language.getString("general.tab.process"),  new JScrollPane(getProcessPanel())); //$NON-NLS-1$
    mSpecificationTabs.addTab(language.getString("general.tab.grabber"),  new JScrollPane(getGrabberPanel())); //$NON-NLS-1$
    mSpecificationTabs.addTab(language.getString("general.tab.external"), new JScrollPane(getExternalPanel())); //$NON-NLS-1$
    mSpecificationTabs.addTab(language.getString("general.tab.ssh"),      new JScrollPane(getTestingPanel())); //$NON-NLS-1$
  }
  return mSpecificationTabs;
}

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

public static void init(JTabbedPane comp, Thing thing, Container parent, ActionContext actionContext){
    JComponentCreator.init(comp, thing, parent, actionContext);
    
    Integer tabLayoutPolicy = null;
    String v = thing.getString("tabLayoutPolicy");
    if("WRAP_TAB_LAYOUT".equals(v)){
      tabLayoutPolicy = JTabbedPane.WRAP_TAB_LAYOUT;
    }else if("WRAP_TAB_LAYOUT".equals(v)){
      tabLayoutPolicy = JTabbedPane.WRAP_TAB_LAYOUT;
    }
    if(tabLayoutPolicy != null){
      comp.setTabLayoutPolicy(tabLayoutPolicy);
    }
    
    Integer tabPlacement = JavaCreator.createInteger(thing, "tabPlacement");
    if(tabPlacement != null){
      comp.setTabPlacement(tabPlacement);
    }
  }
}

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

/** Creates new form. */
  public PaletteColorChooserMainPanel() {
    initComponents();
    setOpaque(false);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);

    tabbedPane.setUI((TabbedPaneUI) PaletteTabbedPaneUI.createUI(tabbedPane));
tabbedPane.putClientProperty("Palette.TabbedPane.paintContentBorder", false);
  }

代码示例来源:origin: igniterealtime/Spark

public SparkTabbedPane(final int type) {
  pane = buildTabbedPane(type);
  pane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
  setLayout(new BorderLayout());
  add(pane);
  ChangeListener changeListener = changeEvent -> {
    JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
    int index = sourceTabbedPane.getSelectedIndex();
    if (index >= 0) {
      fireTabSelected(getTabAt(index), getTabAt(index).getComponent(), index);
    }
  };
  pane.addChangeListener(changeListener);
  closeInactiveButtonIcon = SparkRes.getImageIcon(SparkRes.CLOSE_WHITE_X_IMAGE);
  closeActiveButtonIcon = SparkRes.getImageIcon(SparkRes.CLOSE_DARK_X_IMAGE);
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

public JTabbedContentPane(boolean dragEnabled) {
  super.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
  this.contentMap = new Hashtable<Integer, Content>();
  this.titleIcon = new TextIcon(this, "", TextIcon.ROTATE_NONE);
  this.tabIconTitle = new AggregateIcon(null, titleIcon, SwingConstants.HORIZONTAL);
  this.closeDetachIcon = new AggregateIcon(detachIcon, closeIcon, SwingConstants.HORIZONTAL);
  this.minCloseDetachIcon = new AggregateIcon(minimizeIcon, closeDetachIcon, SwingConstants.HORIZONTAL);
  this.selectedTabIcon = new ExAggregateIcon(tabIconTitle,
                        minCloseDetachIcon,
                        SwingConstants.HORIZONTAL);
  this.flashingContents = new HashMap<Content, Object>();
  this.dragEnabled = dragEnabled;
  setFocusable(false);
  setInheritsPopupMenu(false);
  mouseInputAdapter = new MouseOverTabListener();
  addMouseListener(mouseInputAdapter);
  addMouseMotionListener(mouseInputAdapter);
}

相关文章

JTabbedPane类方法