当前位置: 首页>>代码示例>>Java>>正文


Java BasicTabbedPaneUI类代码示例

本文整理汇总了Java中javax.swing.plaf.basic.BasicTabbedPaneUI的典型用法代码示例。如果您正苦于以下问题:Java BasicTabbedPaneUI类的具体用法?Java BasicTabbedPaneUI怎么用?Java BasicTabbedPaneUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicTabbedPaneUI类属于javax.swing.plaf.basic包,在下文中一共展示了BasicTabbedPaneUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLeadingTabIndex

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
/**
 * @return value of <code>leadingTabIndex</code> field of BasicTabbedPaneUI.ScrollableTabSupport class.
 */
public int getLeadingTabIndex() {
  try {
    final Field tabScrollerField = BasicTabbedPaneUI.class.getDeclaredField(TAB_SCROLLER_NAME);
    tabScrollerField.setAccessible(true);
    final Object tabScrollerValue = tabScrollerField.get(myUI);

    final Field leadingTabIndexField = tabScrollerValue.getClass().getDeclaredField(LEADING_TAB_INDEX_NAME);
    leadingTabIndexField.setAccessible(true);
    return leadingTabIndexField.getInt(tabScrollerValue);
  }
  catch (Exception exc) {
    final String writer = StringUtil.getThrowableText(exc);
    throw new IllegalStateException("myUI=" + myUI + "; cause=" + writer);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TabbedPaneImpl.java

示例2: setLeadingTabIndex

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
public void setLeadingTabIndex(final int leadingIndex) {
  try {
    final Field tabScrollerField = BasicTabbedPaneUI.class.getDeclaredField(TAB_SCROLLER_NAME);
    tabScrollerField.setAccessible(true);
    final Object tabScrollerValue = tabScrollerField.get(myUI);

    Method setLeadingIndexMethod = null;
    final Method[] methods = tabScrollerValue.getClass().getDeclaredMethods();
    for (final Method method : methods) {
      if (SET_LEADING_TAB_INDEX_METHOD.equals(method.getName())) {
        setLeadingIndexMethod = method;
        break;
      }
    }
    if (setLeadingIndexMethod == null) {
      throw new IllegalStateException("method setLeadingTabIndex not found");
    }
    setLeadingIndexMethod.setAccessible(true);
    setLeadingIndexMethod.invoke(tabScrollerValue, Integer.valueOf(getTabPlacement()), Integer.valueOf(leadingIndex));
  }
  catch (Exception exc) {
    final String writer = StringUtil.getThrowableText(exc);
    throw new IllegalStateException("myUI=" + myUI + "; cause=" + writer);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TabbedPaneImpl.java

示例3: TablesPanel

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
TablesPanel(ODLDatastoreUndoable<? extends ODLTableAlterable> globalDs) {
	this.globalDs = globalDs;
	setLayout(new BorderLayout());
	tabbedPane = new JTabbedPane();
	tabbedPane.setUI(new BasicTabbedPaneUI() {
		@Override
		protected int calculateTabAreaHeight(int tab_placement, int run_count, int max_tab_height) {
			// hide tab header if only one class selected
			if (tabbedPane.getTabCount() > 1)
				return super.calculateTabAreaHeight(tab_placement, run_count, max_tab_height);
			else
				return 0;
		}
	});
	add(tabbedPane, BorderLayout.CENTER);
	
	filteredDs = new RowFilterDecorator<>(globalDs);

}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:20,代码来源:TablesPanel.java

示例4: ensureCurrentLayout

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
/**
 * Ensures the current layout.
 */
protected void ensureCurrentLayout() {
	if (!this.tabPane.isValid()) {
		this.tabPane.validate();
	}
	/*
	 * If tabPane doesn't have a peer yet, the validate() call will silently
	 * fail. We handle that by forcing a layout if tabPane is still invalid.
	 * See bug 4237677.
	 */
	if (!this.tabPane.isValid()) {
		LayoutManager lm = this.tabPane.getLayout();
		if (lm instanceof BasicTabbedPaneUI.TabbedPaneLayout) {
			BasicTabbedPaneUI.TabbedPaneLayout layout = (BasicTabbedPaneUI.TabbedPaneLayout) lm;
			layout.calculateLayoutInfo();
		}
	}
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:21,代码来源:SubstanceTabbedPaneUI.java

示例5: makeRollover

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
/**
 * A hack to invoke rollover effect on tab header under mouse cursor when
 * the mouse is within the custom tab header component.
 * @param tabIndex
 */
private void makeRollover( int tabIndex ) {
    if( !(container.getUI() instanceof BasicTabbedPaneUI) ) {
        return;
    }
    BasicTabbedPaneUI ui = ( BasicTabbedPaneUI ) container.getUI();
    try {
        Method m = container.getUI().getClass().getDeclaredMethod( "setRolloverTab", Integer.TYPE ); //NOI18N
        m.setAccessible( true );
        m.invoke( ui, tabIndex );
    } catch( Exception e ) {
        //ignore
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:NBTabbedPaneController.java

示例6: createLayoutManager

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
@Override
protected LayoutManager createLayoutManager() {
	if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) {
		// can't override because private class..
		return super.createLayoutManager();
	} else {
		// override for docking framework spacing fix!
		return new BasicTabbedPaneUI.TabbedPaneLayout() {

			@Override
			protected void calculateTabRects(int tabPlacement, int tabCount) {
				final int spacer = -5;
				final int indent = 0;

				super.calculateTabRects(tabPlacement, tabCount);

				for (int i = 1; i < rects.length; i++) {
					// hack to get the tabs closer together. Don't shift leftmost tab(s)
					if (rects[i].x > 0) {
						rects[i].x += i * spacer + indent;
					}
				}
			}
		};
	}

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:TabbedPaneUI.java

示例7: main

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            JTabbedPane tabbedPane = new JTabbedPane();

            tabbedPane.addTab("Tab 1", new JLabel("Tab 1"));

            // Ensure internal TabbedPane fields are initialized
            tabbedPane.doLayout();

            BasicTabbedPaneUI basicTabbedPaneUI = (BasicTabbedPaneUI) tabbedPane.getUI();

            try {
                Method method = BasicTabbedPaneUI.class.getDeclaredMethod("getTabLabelShiftY", int.class,
                        int.class, boolean.class);

                method.setAccessible(true);

                for (int i = 0; i < 4; i++) {
                    int res = ((Integer) method.invoke(basicTabbedPaneUI, TAB_PLACEMENT[i], 0,
                            IS_SELECTED[i])).intValue();

                    if (res != RETURN_VALUE[i]) {
                        throw new RuntimeException("Test bug7010561 failed on index " + i);
                    }
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

            System.out.println("Test bug7010561 passed");
        }
    });
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:38,代码来源:bug7010561.java

示例8: setUI

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
@Override
public void setUI(final TabbedPaneUI ui){
  super.setUI(ui);
  if(ui instanceof BasicTabbedPaneUI){
    myScrollableTabSupport=new ScrollableTabSupport((BasicTabbedPaneUI)ui);
  }else{
    myScrollableTabSupport=null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TabbedPaneImpl.java

示例9: buildUI

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
private void buildUI() {
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);
    gbc.weighty = 0.01;
    addTab("Windows Bundle", createTab(OSFamily.windows));
    addTab("Linux Bundle", createTab(OSFamily.linux));
    addTab("MacOSX Bundle", createTab(OSFamily.macosx));
    GridBagUtils.addToPanel(this, this.bundleTabPane, gbc, "gridx=0, gridy=0, gridwidth=11, weightx=1");
    GridBagUtils.addToPanel(this, new JLabel("Reflect in Variable:"), gbc, "gridx=0, gridy=1, gridwidth=1, weightx=0");
    variablesCombo = getEditorComponent(OSFamily.all, "updateVariable", this.variables.stream().map(SystemVariable::getKey).toArray());
    GridBagUtils.addToPanel(this, variablesCombo, gbc, "gridx=1, gridy=1, gridwidth=10, weightx=0");
    GridBagUtils.addToPanel(this, new JLabel(" "), gbc, "gridx=0, gridy=2, gridwidth=11, weighty=1");
    int selected = 0;
    switch (Bundle.getCurrentOS()) {
        case windows:
            selected = 0;
            break;
        case linux:
            selected = 1;
            break;
        case macosx:
            selected = 2;
            break;
    }
    this.bundleTabPane.setSelectedIndex(selected);
    this.bundleTabPane.setUI(new BasicTabbedPaneUI());
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:31,代码来源:BundleForm.java

示例10: createMainPanel

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
@Override
protected JTabbedPane createMainPanel() {
    this.tabbedPane = new JTabbedPane(JTabbedPane.LEFT);
    this.tabbedPane.setBorder(BorderFactory.createEmptyBorder());
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    double widthRatio = 0.5;
    formWidth = Math.max((int) (screenSize.width * widthRatio), MIN_TABBED_WIDTH);
    double heightRatio = 0.5;
    int formHeight = Math.max((int) (screenSize.height * heightRatio), MIN_TABBED_HEIGHT);
    tabbedPane.setPreferredSize(new Dimension(formWidth, formHeight));
    getJDialog().setMinimumSize(new Dimension(formWidth + 16, formHeight + 72));

    addTab(tabbedPane, Bundle.CTL_Panel_OperatorDescriptor_Text(), createDescriptorTab());
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_ConfigParams_Text(), createToolInfoPanel());
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_PreProcessing_Border_TitleText(), createPreProcessingTab());
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_OpParams_Border_TitleText(), createParametersTab(formWidth));
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_SysVar_Border_TitleText(), createVariablesPanel());
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_Bundle_TitleText(), createBundlePanel());
    currentIndex++;

    tabbedPane.setUI(new BasicTabbedPaneUI());

    formWidth = tabbedPane.getTabComponentAt(0).getWidth();

    return tabbedPane;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:32,代码来源:ToolAdapterTabbedEditorDialog.java

示例11: makeTabVisible

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
private boolean makeTabVisible(JTabbedPane tp, int selectedTab) {
    validateTab();
    if (!(tp.getUI() instanceof BasicTabbedPaneUI)) {
        try {
            EventQueueWait.call(tp, "setSelectedIndex", selectedTab);
        } catch (NoSuchMethodException e) {
            throw new InvalidElementStateException(
                    "Unable to call setSelectedIndex on JTabbedPane. selectedTab = " + selectedTab, e);
        }
        return true;
    }
    boolean isVisible = false;
    int n = tp.getTabCount();
    int loopCount = n;
    Action backward = tp.getActionMap().get("scrollTabsBackwardAction");
    Action forward = tp.getActionMap().get("scrollTabsForwardAction");
    while (!isVisible && loopCount-- > 0) {
        int firstVisibleTab = -1, lastVisibleTab = -1;
        for (int i = 0; i < n; i++) {
            Rectangle tabBounds = tp.getBoundsAt(i);
            int tabForCoordinate = tp.getUI().tabForCoordinate(tp, tabBounds.x + tabBounds.width / 2,
                    tabBounds.y + tabBounds.height / 2);
            if (tabForCoordinate != -1) {
                if (firstVisibleTab == -1) {
                    firstVisibleTab = tabForCoordinate;
                }
                lastVisibleTab = tabForCoordinate;
            }
        }
        isVisible = firstVisibleTab <= selectedTab && selectedTab <= lastVisibleTab;
        if (isVisible) {
            continue;
        }
        if (selectedTab < firstVisibleTab) {
            backward.actionPerformed(new ActionEvent(tp, ActionEvent.ACTION_PERFORMED, ""));
        } else {
            forward.actionPerformed(new ActionEvent(tp, ActionEvent.ACTION_PERFORMED, ""));
        }
    }
    return isVisible;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:42,代码来源:JTabbedPaneTabJavaElement.java

示例12: loadLibrary

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
public void loadLibrary(String destination)
{
    // load the library
    Library library = Library.getInstance();
    library.load(destination);
    tabs.removeAll();

    // hide the tabs
    tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); //WRAP_TAB_LAYOUT || SCROLL_TAB_LAYOUT);
    tabs.setUI(new BasicTabbedPaneUI() {  
        @Override  
        protected int calculateTabAreaHeight(int tab_placement, int run_count, int max_tab_height) {  
            /*if (tabs.getTabCount() > 1)
                return super.calculateTabAreaHeight(tab_placement, run_count, max_tab_height);  
            else*/ 
                return 0;  
        }  
    });
    
    // jlist with colored items
    catList.setCellRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            Color col = (new BloxsDefinitions()).getColor(value.toString());
            if (col==null) col=Color.white;
            
            setBackground(col);
            if (isSelected) {
                 setBackground(getBackground().darker());
            }
            
            JPanel p = new JPanel();
            p.setLayout(new BorderLayout());
            p.setBorder(new LineBorder(col, 5));
            p.add(c,BorderLayout.CENTER);
            return p;
        }
    });
    //catList.setFixedCellHeight(50);
    //catList.setFixedCellWidth(100);
    

    
    Vector<String> names = new Vector<>();
    for (int i = 0; i < library.getTabs().size(); i++) {
        LibraryPanel ep = library.getTabs().get(i);
        // register the library for the mouse events
        // it will pass them on to the actual opened editor
        ep.addMouseListener(library);
        ep.addMouseMotionListener(library);
        ep.revalidate();
        JScrollPane scroll = new JScrollPane(ep);
        scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
        names.add(ep.getLabel());
        tabs.add(ep.getLabel(), scroll);
    }
    catList.setListData(names);
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:61,代码来源:MainFrame.java

示例13: ScrollableTabSupport

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
public ScrollableTabSupport(final BasicTabbedPaneUI ui){
  myUI=ui;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TabbedPaneImpl.java

示例14: AntibodyEditorGUI

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
/**
 * Constructor that creates the antibody editor GUI.
 * 
 * @param parentFrame
 */
protected AntibodyEditorGUI(JFrame parentFrame) {
  this.parentFrame = parentFrame;

  // create editor
  initLnF();

  parentFrame.setJMenuBar(createMenuBar());

  JPanel upperPanel = new JPanel();
  upperPanel.add(new JLabel("upper panel (curr. unused)"));

  JPanel antibodyPanel = new JPanel();
  antibodyPanel.setLayout(new BorderLayout());
  antibodyPanel.setPreferredSize(new Dimension(100, 10));
  JTabbedPane tabbedPane = new JTabbedPane();
  tabbedPane.setPreferredSize(new Dimension(100, 50));

  JPanel antibodyView = new JPanel();
  antibodyView.setLayout(new BorderLayout());
  antibodyView.setBackground(Color.WHITE);

  tabbedPane.add("Antibody View", antibodyView);
  tabbedPane.setUI(new BasicTabbedPaneUI() {
    @Override
    protected int calculateTabAreaHeight(int tab_placement, int run_count, int max_tab_height) {
      return 0;
    }
  });
  antibodyPanel.add(tabbedPane, BorderLayout.CENTER);

  // JSplitPane viewSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upperPanel,
  // antibodyPanel);
  UIService.getInstance().setAntibodyPanel(parentFrame, antibodyView);

  // viewSplitPane.setDividerLocation(50);
  // viewSplitPane.setOneTouchExpandable(false);

  // create buttons
  JPanel buttonPanel = createButtonPanel();
  UIService.getInstance().setToolBar(createToolBar());

  this.contentPanel = new JPanel();
  this.contentPanel.setLayout(new BorderLayout());
  // getContentPane().add(BorderLayout.CENTER, editor.getContentComponent());
  // this.contentPanel.add(viewSplitPane, BorderLayout.CENTER);
  this.contentPanel.add(UIService.getInstance().getToolBar(), BorderLayout.NORTH);
  this.contentPanel.add(antibodyPanel, BorderLayout.CENTER);
  this.contentPanel.add(buttonPanel, BorderLayout.SOUTH);

  PluginLoader.getInstance().loadMenuPlugins();
  PluginLoader.getInstance().loadToolbarPlugins();
}
 
开发者ID:PistoiaHELM,项目名称:HELMAntibodyEditor,代码行数:58,代码来源:AntibodyEditorGUI.java

示例15: MainPane

import javax.swing.plaf.basic.BasicTabbedPaneUI; //导入依赖的package包/类
/**
  *  Constructor for the MainPane class. 
**/

   public MainPane(VenusUI appFrame, Editor editor, RegistersWindow regs,
                   Coprocessor1Window cop1Regs,Coprocessor0Window cop0Regs){
     super();
     this.mainUI = appFrame;
     this.setTabPlacement(JTabbedPane.TOP); //LEFT);
     if (this.getUI() instanceof BasicTabbedPaneUI) {
        BasicTabbedPaneUI ui = (BasicTabbedPaneUI) this.getUI();
     }
     editTabbedPane = new EditTabbedPane(appFrame, editor, this);
     executeTab = new ExecutePane(appFrame, regs, cop1Regs, cop0Regs);
     String editTabTitle = "Edit"; //"<html><center>&nbsp;<br>E<br>d<br>i<br>t<br>&nbsp;</center></html>";
     String executeTabTitle = "Execute"; //"<html><center>&nbsp;<br>E<br>x<br>e<br>c<br>u<br>t<br>e<br>&nbsp;</center></html>";
     Icon editTabIcon = null;//new ImageIcon(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource(Globals.imagesPath+"Edit_tab.jpg")));
     Icon executeTabIcon = null;//new ImageIcon(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource(Globals.imagesPath+"Execute_tab.jpg")));
  
     this.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
     this.addTab(editTabTitle, editTabIcon, editTabbedPane);
  	
     // this.addTab("<html><center>&nbsp;<br>P<br>r<br>o<br>j<br>&nbsp;<br>1<br&nbsp;</center></html>", null, new JTabbedPane());	
     // this.addTab("<html><center>&nbsp;<br>P<br>r<br>o<br>j<br>&nbsp;<br>2<br&nbsp;</center></html>", null, new JTabbedPane());
     // this.addTab("<html><center>&nbsp;<br>P<br>r<br>o<br>j<br>&nbsp;<br>3<br&nbsp;</center></html>", null, new JTabbedPane());
     // this.addTab("<html><center>&nbsp;<br>P<br>r<br>o<br>j<br>&nbsp;<br>4<br&nbsp;</center></html>", null, new JTabbedPane());
  										
     this.addTab(executeTabTitle, executeTabIcon, executeTab);
  
     this.setToolTipTextAt(0,"Text editor for composing MIPS programs.");
     this.setToolTipTextAt(1,"View and control assembly language program execution.  Enabled upon successful assemble.");
  
  	/* Listener has one specific purpose: when Execute tab is selected for the 
  	 * first time, set the bounds of its internal frames by invoking the
  	 * setWindowsBounds() method.  Once this occurs, listener removes itself!
  	 * We do NOT want to reset bounds each time Execute tab is selected.
  	 * See ExecutePane.setWindowsBounds documentation for more details.
  	 */
     this.addChangeListener(
            new ChangeListener() {
               public void stateChanged(ChangeEvent ce) {
                 JTabbedPane tabbedPane = (JTabbedPane) ce.getSource();
                 int index = tabbedPane.getSelectedIndex();
                 Component c = tabbedPane.getComponentAt(index);
                 ExecutePane executePane = Globals.getGui().getMainPane().getExecutePane();
                 if (c == executePane) {
                    executePane.setWindowBounds();
                    Globals.getGui().getMainPane().removeChangeListener(this);
                 } 
              }
           });
  }
 
开发者ID:captainepoch,项目名称:MARS_Assembler,代码行数:53,代码来源:MainPane.java


注:本文中的javax.swing.plaf.basic.BasicTabbedPaneUI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。