Ideas for a "virtually" tabbed pane

I'm developing on this application for keeping information about products and customers in a shop.
In my "product manager" window I would like to have tabbed pane with an input interface for different types of goods in each tab respectively. But since the interface is more or less the same for different products (with fields like product name beeing persistent), it would be better to just alter the input components programmatically (in the pane's stateChanged event), rather than having to duplicate components for 7 different tabs... Hope my point gets through. This is strictly a matter of Look & Feel -- this is the most neat sollution i could think of :)

mannamann wrote:
I appreciate your commitment to ridding the forums of the "by getters". I know that my question was probably a little superficial, and something that I could have figured out myself. My goal is not to get rid of get byers, but I will want to expend more of my free time and effort helping those where the paybacks for me are greatest -- the highly motivated. It is truly amazing and gratifying to see those of this kind progress.
But since the primary focus of our project is not GUI-programming, isn't it fair to post a "quicky" here, to draw some knowledge from experts like you? So that I don't have to spend my entire day working out UI, when I prefered to focus on the data model of my program. After all, isn't that what the forum is all about?It's about sharing knowledge, of course, but having said that, you can't ignore the human component either. We're all volunteers, and given our druthers, we'll put in more effort towards those who do likewise. You really can't expect otherwise, right?

Similar Messages

  • Swing Tabbed Pane Event

    Does anyone know how to put an event listenter/handeller etc on the event for selecting a tabbed pane from a tab.
    What type of listener is used and what event?
    I want to change the caption on a label when a tab is selected using the setText() method
    thanks

    Here is a link to a section in the Swing tutorial titled "Listeners Supported by Swing Components"
    http://java.sun.com/docs/books/tutorial/uiswing/events/eventsandcomponents.html
    The tutorial also shows you how to write a listener. Keep this link for future reference.

  • Integrate a close button with tabbed pane?

    I like FireFox and I like using parts of its design concepts. How do I put a close button on the right corner of a tab using swing? Maybe I need a "cross" image? Maybe I just put an "X" character there?
    I tried tabProcessToBeClosed.close() or tabProcessToBeClosed.exit(), but it does not close the tab. Is there any other ways?

    I found the following to be extremely useful for constructing a tabbed pane with or without a close button.
    [http://weblogs.java.net/blog/alexfromsun/archive/2005/11/tabcomponents_i_1.html|http://weblogs.java.net/blog/alexfromsun/archive/2005/11/tabcomponents_i_1.html]

  • Setting color for disabled tab pane header.

    How can I change the color of a tab header (in tabbed pane) that is disabled?
    Many thanks.
    Shay.

    I can sugest you to :
    -> create your own TableHeader, that you could draw it like you want
    -> Don't use the header, and define your own TableModel and the apparenece
    -> Use the setBackground method of JTableHeader
    -> Define your own Look And Feel

  • Disposable tabbed pane redrawing

    Hi, i'm using disposable tabbed panes (with close button) in my program and i'm using following method to update their titles according to what user entered:
    //this is class extending JPanel
    public void updatePanelTitle(String newTitle) {
            MainPanel panel = (MainPanel) getParent(); //MainPanel extends JTabbedPane
            panel.setTitleAt(panel.getComponentZOrder(this)-1, newTitle);
            repaint();
        }Point is the title gets changed but the size of panel label does not. However, when i mouse-over the close button there, it gets changed to the size of the text.
    @Override
            public void mouseEntered(MouseEvent e) {
                Component component = e.getComponent();
                if (component instanceof AbstractButton) {
                    AbstractButton button = (AbstractButton) component;
                    button.setBorderPainted(true);
            }setBorderPainted calls inside the repaint method.
    Can anyone give a clue why it is not working or how to fix it?
    Regards,
    Marek

    Well its quite big but if it helps, this is the panel class:
    package presentationTier.view;
    import com.bbgroup.ui.Console;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextField;
    import javax.swing.border.Border;
    import javax.swing.text.BadLocationException;
    import presentationTier.Model.Properties;
    import presentationTier.Model.PropertyInterface;
    import presentationTier.Model.StandardInputOutput;
    import presentationTier.controller.ConfirmListGeneratorAction;
    import presentationTier.controller.ConfirmSearchReplaceAction;
    import presentationTier.controller.OpenBrowseDialogAction;
    * @author marek
    public class ListGeneratorPanel extends JPanel implements StandardInputOutput, PropertyInterface {
        private JLabel labStartPath,  labExtensions;
        private JTextField txtStartPath,  txtExtensions;
        private JButton butBrowse,  butGo;
        private Console console;
        private GridBagConstraints c;
        private Insets labelInsets,  normalInsets;
        public ListGeneratorPanel() {
            super(new GridBagLayout());
            initComponents();
            borderCompononets(BorderFactory.createLoweredBevelBorder());
            resetConstraints();
            c.gridx = 0;
            c.gridy = 0;
            c.insets = labelInsets;
            add(labStartPath, c);
            c.gridx = 1;
            //c.gridwidth = 1;
            c.weightx = 1;
            c.insets = normalInsets;
            add(txtStartPath, c);
            c.gridx = 2;
            //c.gridwidth = 1;
            c.weightx = 0;
            add(butBrowse, c);
            c.gridx = 0;
            c.gridy = 1;
            c.weightx = 0;
            c.insets = labelInsets;
            add(labExtensions, c);
            c.gridx = 1;
            //c.gridwidth = 3;
            c.weightx = 1;
            c.insets = normalInsets;
            add(txtExtensions, c);
            c.gridx = 2;
            c.gridwidth = 1;
            //c.gridheight = 1;
            c.weightx = 0;
            add(butGo, c);
            c.gridx = 0;
            c.gridy = 2;
            c.gridwidth = 5;
            c.weighty = 1;
            add(new JScrollPane(console), c);
            resetConstraints();
        private void initComponents() {
            c = new GridBagConstraints();
            console = new Console(true);
            labelInsets = new Insets(5, 5, 0, 0);
            normalInsets = new Insets(5, 5, 0, 5);
            labStartPath = new JLabel("Search under:");
            labExtensions = new JLabel("File types:");
            txtStartPath = new JTextField();
            txtExtensions = new JTextField();
            butBrowse = new JButton(new OpenBrowseDialogAction(this));
            butGo = new JButton(new ConfirmListGeneratorAction(this));
        private void borderCompononets(Border b) {
            getTxtStartPath().setBorder(b);
            getTxtExtensions().setBorder(b);
        private void resetConstraints() {
            c.ipadx = 0;
            c.ipady = 0;
            c.gridwidth = 1;
            c.gridheight = 1;
            c.weightx = 0;
            c.weighty = 0;
            c.fill = GridBagConstraints.BOTH;
            c.anchor = GridBagConstraints.FIRST_LINE_START;
            c.insets = normalInsets;
        public Properties createProperties() {
            Properties p = new Properties();
            p.setSout(this);
            p.setStartPath(getTxtStartPath().getText());
            p.setExtensions(getTxtExtensions().getText());
            return p;
         * @param line
         * @throws BadLocationException
        public void echo(String line) throws BadLocationException {
            getConsole().echo(line);
         * @param line
         * @param style
         * @throws BadLocationException
        public void echo(String line, String style) throws BadLocationException {
            getConsole().echo(line, style);
        public void drawSeparator() throws BadLocationException {
            getConsole().drawSeparator();
        public void passBrowsedFilePath(String browsedFilePath) {
            getTxtStartPath().setText(browsedFilePath);
        public void updatePanelTitle(String newTitle) {
            MainPanel panel = (MainPanel) getParent();
            panel.setTitleAt(panel.getComponentZOrder(this) - 1, "Generate: " + newTitle);
            updateUI();
            repaint();
        public Console getConsole() {
            return console;
        public JTextField getTxtStartPath() {
            return txtStartPath;
        public JTextField getTxtExtensions() {
            return txtExtensions;
    }When you add instance of this to your JTabbedPane, you will get closeable Tabbed Pane with title you specified in addTab(title, component);
    I implement method updatePanelTitle(String newTitle); to change the title of this tab when suer submits the data. These action controllers that call submitting and updating title are in controller package. Problem is that the title itself is changed when data are submitted but the <b>size of the tab is not adjusted to newTitles length.</b> It is just adjusted when i pull my mouse over the close button that implements action from previous post. It's in this class:
    package com.bbgroup.ui;
    import javax.swing.*;
    import javax.swing.plaf.basic.BasicButtonUI;
    import java.awt.*;
    import java.awt.event.*;
    * Component to be used as tabComponent;
    * Contains a JLabel to show the text and
    * a JButton to close the tab it belongs to
    public class DisposableTabPanel extends JPanel {
        private final JTabbedPane pane;
        public DisposableTabPanel(final JTabbedPane pane) {
            //unset default FlowLayout' gaps
            super(new FlowLayout(FlowLayout.LEFT, 0, 0));
            if (pane == null) {
                throw new NullPointerException("TabbedPane is null");
            this.pane = pane;
            setOpaque(false);
            //make JLabel read titles from JTabbedPane
            JLabel label = new JLabel() {
                @Override
                public String getText() {
                    int i = pane.indexOfTabComponent(DisposableTabPanel.this);
                    if (i != -1) {
                        return pane.getTitleAt(i);
                    return null;
            add(label);
            //add more space between the label and the button
            label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
            //tab button
            JButton button = new TabButton();
            add(button);
            //add more space to the top of the component
            setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
        private class TabButton extends JButton implements ActionListener {
            public TabButton() {
                int size = 17;
                setPreferredSize(new Dimension(size, size));
                setToolTipText("Close this tab");
                //Make the button looks the same for all Laf's
                setUI(new BasicButtonUI());
                //Make it transparent
                setContentAreaFilled(false);
                //No need to be focusable
                setFocusable(false);
                setBorder(BorderFactory.createEtchedBorder());
                setBorderPainted(false);
                //Making nice rollover effect
                //we use the same listener for all buttons
                addMouseListener(buttonMouseListener);
                setRolloverEnabled(true);
                //Close the proper tab by clicking the button
                addActionListener(this);
            public void actionPerformed(ActionEvent e) {
                int i = pane.indexOfTabComponent(DisposableTabPanel.this);
                if (i != -1) {
                    pane.remove(i);
            //we don't want to update UI for this button
            public void updateUI() {
            //paint the cross
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                Graphics2D g2 = (Graphics2D) g.create();
                //shift the image for pressed buttons
                if (getModel().isPressed()) {
                    g2.translate(1, 1);
                g2.setStroke(new BasicStroke(2));
                g2.setColor(Color.BLACK);
                if (getModel().isRollover()) {
                    g2.setColor(Color.MAGENTA);
                int delta = 6;
                g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);
                g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);
                g2.dispose();
        private final static MouseListener buttonMouseListener = new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
                Component component = e.getComponent();
                if (component instanceof AbstractButton) {
                    AbstractButton button = (AbstractButton) component;
                    button.setBorderPainted(true);
            @Override
            public void mouseExited(MouseEvent e) {
                Component component = e.getComponent();
                if (component instanceof AbstractButton) {
                    AbstractButton button = (AbstractButton) component;
                    button.setBorderPainted(false);
    }I cant possibly post a running code as it uses third party libraries and implements bunch of interfaces, it would require whole nearly whole view-controller part of the project.
    Another problem is that method getComponentZOrder(this) - 1, works for retrieving all tabs except the first one (it returns fine indexes for any tab but -1 for the first one) but sadly there is no such method like getIndex(Component) which would be useful for getting <b>this</b> components index.
    Thanks in advance for ideas.
    Regards, Marek

  • So when I plug my iPhone 3GS into my iMac, for music reasons, it says I have 123 songs. When I plug my iTouch into my iMac it says I have 565 songs on my iTouch. I have the same apple idea for both my iPhone and iTouch, how do I transfer my 565tomyiphone

    So when I plug my iPhone 3GS into my iMac, for music reasons, it says I have 123 songs. When I plug my iTouch into my iMac it says I have 565 songs on my iTouch. I have the same apple idea for both my iPhone and iTouch, how do I transfer my 565 songs on my iTouch to my iPhone? PLEASE HELP!!!

    When you connect your iPad or iPod to the Mac, click on the device name in iTunes - don't click on the arrow on the device. Then click on the Music tab in the main window pane. Now you should see 'Sync Music' and all your playlists, artists and albums. Here you mark the checkboxes for what should be synced.

  • Tabbed pane vs swf file

    Hi,
    I am writing my tabbed pane as
    <mx:TabNavigator>
    <mx:VBox>...................</mx:VBox>
    <mx:VBox>...................</mx:VBox>
    <mx:VBox>...................</mx:VBox>
    </mx:TabNavigator>
    I want to put wipe effect ot my tabbed pane when we change
    the tabbes. I dont find any examples for that, so i have one plan.
    I want to disply one swf file on the vboxes when we change the tab
    from onto anoterh can we show one .swf file on the vbox, that swf
    will have continious wiping effects. I dont know this posibility
    level!. If so, can we specify any divs on the form? is it correct
    idea?
    Thanks
    Satish KC.

    If you are running Flex 2.0, then you can put showEffect and
    hideEffect
    effect triggers on each VBox. (I don't remember if this works
    in beta3)
    <mx:VBox showEffect="WipeLeft" hideEffect="WipeRight">
    If using Flex 1.5, then set the creationPolicy of the
    TabNavigator to "all"
    and try playing around with the changeEffect on the TabNav.
    Jason Szeto
    Adobe Flex SDK Developer
    "j2eesatish" <[email protected]> wrote in
    message
    news:e7egct$8o5$[email protected]..
    > Hi,
    > I am writing my tabbed pane as
    > <mx:TabNavigator>
    > <mx:VBox>...................</mx:VBox>
    > <mx:VBox>...................</mx:VBox>
    > <mx:VBox>...................</mx:VBox>
    > </mx:TabNavigator>
    > I want to put wipe effect ot my tabbed pane when we
    change the
    > tabbes. I
    > dont find any examples for that, so i have one plan. I
    want to disply one
    > swf
    > file on the vboxes when we change the tab from onto
    anoterh can we show
    > one
    > .swf file on the vbox, that swf will have continious
    wiping effects. I
    > dont
    > know this posibility level!. If so, can we specify any
    divs on the form?
    > is it
    > correct idea?
    >
    >
    > Thanks
    > Satish KC.
    >

  • How do you undo pane tiling?  Or get back to a tabbed pane?

    One of our developers has managed to 'untab' 3 sql panes so they are appearing as 3 separate dockable panes. How do you take these 3 panes back into a tabbed pane (other than restarting SQL Developer)?
    Message was edited by:
    Andy Riley

    A "hidden" feature that not many people discover is that you can double click on the tab for a code editor, and it will maximize to take the whole of the main window. Double click its tab again, and it will shrink back to its original size.
    Not exactly "tear-out" (which I agree would be nice... you should file that on the SQL Developer suggestion forum so that it winds its way back to the IDE team), but very useful if you have lots of code to edit :)
    Brian

  • Problem in tabbed panes

    hai friends,
    i am trying to create a tabbed pane which contains 3 panes.(top)
    and i try to add a tabbed pane at bottom of first pane which is a panel.
    i have set the size of panel as panel.setPreferredSize(new Dimension(750, 475));
    Now i am finding i cannot view the tabbed panes added to the panel.
    the relevant code is given below.
    some one have any idea..
    panel.add(new JScrollPane(textArea));
    panel.add(new JScrollPane(table));
    panel.setPreferredSize(new Dimension(750, 475));
    panel.setBackground(Color.PINK);
    JTabbedPane tabbedPane2 = new JTabbedPane     (JTabbedPane.BOTTOM);
    tabbedPane2.add("Result",new JTable(10,10));
    tabbedPane2.add("Message",new JTextArea());
    panel.add(tabbedPane2);
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.addTab("name1", new JScrollPane(panel));
    tabbedPane.addTab("name2",
         new JScrollPane(new JTextArea(5, 5)));
    tabbedPane.addTab("ANALYSIS", new JButton("<   HAI ALL   >"));
    container.add(tabbedPane);
    tabbedPane.setBackground(Color.ORANGE);

    i am giving the code i have done for the development of schema browser.
    i have some what overcome the problem i have faced. but i know its not a proper way.
    i am not able to use other layouts successfully to arrange these components.The layout now i have is not good enough.
    may be because i am beginner.
    kindly give your comments.....
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTabbedPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.border.BevelBorder;
    public class Trial1 extends JFrame implements ActionListener {
         Container container = null;
         private JTextArea textArea;
         private JTextArea result = new JTextArea();
         private JButton connection;
         private JButton execute;
         private ResultSet rs;
         private Connection con;
         public Trial1(String title) {
              super(title);
              container = this.getContentPane();
              container.setBackground(Color.BLACK);
              menu();
              panes();
              makeConnection();
              container.setLayout(new FlowLayout());
              this.setSize(800, 575);
              show();
         void menu() {
              JMenuBar menuBar = new JMenuBar();
              container.add(menuBar, FlowLayout.LEFT);
              menuBar.setBorder(new BevelBorder(BevelBorder.RAISED));
              menuBar.setForeground(Color.blue);
              JMenu file = new JMenu("File");
              JMenu edit = new JMenu("Edit");
              JMenu query = new JMenu("Query");
              menuBar.add(file);
              menuBar.add(edit);
              menuBar.add(query);
              file.add(new JMenuItem("New"));
              file.add(new JMenuItem("Open"));
              file.add(new JMenuItem("Save"));
              file.add(new JMenuItem("Save As"));
              file.addSeparator();
              file.add(new JMenuItem("Exit"));
              edit.add(new JMenuItem("Undo"));
              edit.addSeparator();
              edit.add(new JMenuItem("Cut"));
              edit.add(new JMenuItem("Copy"));
              edit.add(new JMenuItem("Paste"));
              edit.addSeparator();
              edit.add(new JMenuItem("Delete"));
              edit.add(new JMenuItem("Select All"));
              query.add(new JMenuItem("Compile"));
              query.add(new JMenuItem("Run"));
              query.add(new JMenuItem("Execute"));
              setJMenuBar(menuBar);
         void panes() {
              JPanel panel = new JPanel();
              textArea = new JTextArea(4, 50);
              textArea.setBorder(BorderFactory.createLineBorder(Color.black));
              JTabbedPane tabbedPane2 = new JTabbedPane(JTabbedPane.BOTTOM);
              JTable table = new JTable(5,10);
              tabbedPane2.add("Result",table);
              table.setBorder(BorderFactory.createLineBorder(Color.black));
              tabbedPane2.add("Message",result);
              tabbedPane2.setPreferredSize(new Dimension(750, 350));
              tabbedPane2.setBackground(Color.ORANGE);
              connection = new JButton("Connection");
              panel.add(connection);
              execute = new JButton("    Execute       ");
              execute.addActionListener(this);
              panel.add(execute);
              panel.add(new JScrollPane(textArea));
              panel.add(tabbedPane2);
              //panel.add(new JScrollPane(table));
              panel.setPreferredSize(new Dimension(750, 475));
              panel.setBackground(Color.PINK);
              //panel.setLayout(new GridLayout(2,3));
              JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
              tabbedPane.addTab("QUERY", new JScrollPane(panel));
              tabbedPane.addTab("SCHEMA BROWSER",
                        new JScrollPane(new JTextArea(5, 5)));
              tabbedPane.addTab("ANALYSIS", new JButton("<   HAI ALL   >"));
              container.add(tabbedPane);
              tabbedPane.setBackground(Color.ORANGE);
         public void actionPerformed(ActionEvent e) {
              Object src = e.getSource();
              /* myArea.getDocument().addDocumentListener( */
              if (src == execute) {
                   String query = textArea.getText();
                   try {
                        Statement smt;
                        smt = null;
                        smt = con.createStatement();
                        rs = smt.executeQuery(query);
                        while (rs.next()) {
                             result.append(rs.getString(1) + "\t" + rs.getInt(2)
                                       + "\n");
                        smt.close();
                   } catch (Exception ae) {
                        ae.printStackTrace();
         void makeConnection() {
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection("jdbc:odbc:jmc", "sa", "sprint");
                   //con.close();
                   System.out.println("Connection successfully estabilished.");
              } catch (Exception ae) {
                   ae.printStackTrace();
         public static void main(String arg[]) {
              Trial1 trial = new Trial1(
                        "trials.");
    }

  • How can i place button on top right hand corner of the tabbed pane

    Hi all,
    i want to place button on top right hand corner of the tabbed pane, just run the code below, i have add button(it going to insert tab into tabbedpane), i want to place that tab into top right hand corner of the tabbedpane (not inside the tab itself). if i set tab policy setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT), it will give two button at right hand corner along with those buttons i want to and one more add button.
    please suggest so that i can move forward.
    Thanks in advance
    import java.awt.Dimension;
    import java.util.HashMap;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    * @author  Dayananda.BV
    public class TabpaneDemo extends javax.swing.JFrame {
        /** Creates new form TabpaneDemo */
        HashMap<Integer, tabpanel> panelMap = new HashMap<Integer, tabpanel>();
        public TabpaneDemo() {
            initComponents();
            createFloorPlan();
            getContentPane().setPreferredSize(new Dimension(400,400));
            jTabbedPane1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            jTabbedPane1 = new javax.swing.JTabbedPane();
            add_tab_button = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            add_tab_button.setText("+");
            add_tab_button.setMargin(new java.awt.Insets(0, 0, 0, 0));
            add_tab_button.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    add_tab_buttonActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(308, Short.MAX_VALUE)
                    .addComponent(add_tab_button, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(67, 67, 67))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(add_tab_button)
                    .addGap(8, 8, 8)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 292, Short.MAX_VALUE))
            pack();
        }// </editor-fold>                       
        private void createFloorPlan(){
            tabpanel floorplan_Panel = new tabpanel(panelMap.size()+1);
            panelMap.put(floorplan_Panel.getTabIndex(), floorplan_Panel);
            jTabbedPane1.add(floorplan_Panel, floorplan_Panel.getTabName());
            jTabbedPane1.setSelectedIndex(jTabbedPane1.getTabCount()-1);
        private void add_tab_buttonActionPerformed(java.awt.event.ActionEvent evt) {                                              
            createFloorPlan();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TabpaneDemo().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JButton add_tab_button;
        private javax.swing.JTabbedPane jTabbedPane1;
        // End of variables declaration                  
        class tabpanel extends JPanel{
            private int tabIndex = 0;
            private String tabName ;
            public tabpanel(int tabIndex) {
                this.tabIndex = tabIndex;
                if(tabIndex >= 10) {
                    tabName = "Floor Map"+tabIndex;
                } else{
                    tabName = "Floor Map"+tabIndex+"  ";
            public int getTabIndex(){
                return tabIndex;
            public String getTabName(){
                return tabName;
    }Thanks
    Dayananda B V

    This part of tabbed pane is not customizable as it lies in the ComponentUI(TabbedpaneUI) portion of the tabbedpane.
    But I can point out the place u can change to bring the desired feature into effect.
    U can find an Inner class called ScrollableTabSupport
    Look for the methods createButtons where u can create extra buttons and add to the tabbed pane.
    The Inner class also implements actionListener where u can implement the action for the button u added.
    By this method U have to use your own extended TabbedPaneUI which u cant escape from.
    Hope this will help u.

  • How to drag and drop tab nodes between tab panes

    I'm working on example from this tutorial( Drag-and-Drop Feature in JavaFX Applications | JavaFX 2 Tutorials and Documentation ). Based on the tutorial I want to drag tabs between two tabs. So far I managed to create this code but I need some help in order to finish the code.
    Source
    tabPane = new TabPane();
    Tab tabA = new Tab();
       Label tabALabel = new Label("Main Component");
    tabPane.setOnDragDetected(new EventHandler<MouseEvent>()
                @Override
                public void handle(MouseEvent event)
                    /* drag was detected, start drag-and-drop gesture*/
                    System.out.println("onDragDetected");
                    /* allow any transfer mode */
                    Dragboard db = tabPane.startDragAndDrop(TransferMode.ANY);
                    /* put a string on dragboard */
                    ClipboardContent content = new ClipboardContent();
                    content.put(DataFormat.PLAIN_TEXT, tabPane);
                    db.setContent(content);
                    event.consume();
    What is the proper way to insert the content of the tab as object? Into the tutorial simple text is transferred. How I must modify this line content.put(DataFormat.PLAIN_TEXT, tabPane);?
    And what is the proper way to insert the tab after I drag the tab:
    Destination
    tabPane.setOnDragDropped(new EventHandler<DragEvent>()
                @Override
                public void handle(DragEvent event)
                    /* data dropped */
                    /* if there is a string data on dragboard, read it and use it */
                    Dragboard db = event.getDragboard();
                    boolean success = false;
                    if (db.hasString())
                        //tabPane.setText(db.getString());
                        Tab tabC = new Tab();
                        tabPane.getTabs().add(tabC);
                        success = true;
                    /* let the source know whether the string was successfully
                     * transferred and used */
                    event.setDropCompleted(success);
                    event.consume();
    I suppose that this transfer can be accomplished?
    Ref javafx 2 - How to drag and drop tab nodes between tab panes - Stack Overflow

    I would use a graphic (instead of text) for the Tabs and call setOnDragDetected on that graphic. That way you know which tab is being dragged. There's no nice way to put the Tab itself into the dragboard as it's not serializable (see https://javafx-jira.kenai.com/browse/RT-29082), so you probably just want to store the tab currently being dragged in a property.
    Here's a quick example; it just adds the tab to the end of the current tabs in the dropped pane. If you wanted to insert it into the nearest location to the actual drop you could probably iterate through the tabs and figure the coordinates of each tab's graphic, or something.
    import java.util.Random;
    import javafx.application.Application;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.Tab;
    import javafx.scene.control.TabPane;
    import javafx.scene.input.ClipboardContent;
    import javafx.scene.input.DragEvent;
    import javafx.scene.input.Dragboard;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.input.TransferMode;
    import javafx.scene.layout.StackPane;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class DraggingTabPane extends Application {
      private static final String TAB_DRAG_KEY = "tab" ;
      private ObjectProperty<Tab> draggingTab ;
    @Override
      public void start(Stage primaryStage) {
      draggingTab = new SimpleObjectProperty<>();
      TabPane tabPane1 = createTabPane();
      TabPane tabPane2 = createTabPane();
      VBox root = new VBox(10);
      root.getChildren().addAll(tabPane1, tabPane2);
      final Random rng = new Random();
      for (int i=1; i<=8; i++) {
        final Tab tab = createTab("Tab "+i);
        final StackPane pane = new StackPane();
          int red = rng.nextInt(256);
          int green = rng.nextInt(256);
          int blue = rng.nextInt(256);
        String style = String.format("-fx-background-color: rgb(%d, %d, %d);", red, green, blue);
        pane.setStyle(style);
        final Label label = new Label("This is tab "+i);
        label.setStyle(String.format("-fx-text-fill: rgb(%d, %d, %d);", 256-red, 256-green, 256-blue));
        pane.getChildren().add(label);
        pane.setMinWidth(600);
        pane.setMinHeight(250);
        tab.setContent(pane);
        if (i<=4) {
          tabPane1.getTabs().add(tab);
        } else {
          tabPane2.getTabs().add(tab);
      primaryStage.setScene(new Scene(root, 600, 600));
      primaryStage.show();
      public static void main(String[] args) {
      launch(args);
      private TabPane createTabPane() {
        final TabPane tabPane = new TabPane();
        tabPane.setOnDragOver(new EventHandler<DragEvent>() {
          @Override
          public void handle(DragEvent event) {
            final Dragboard dragboard = event.getDragboard();
            if (dragboard.hasString()
                && TAB_DRAG_KEY.equals(dragboard.getString())
                && draggingTab.get() != null
                && draggingTab.get().getTabPane() != tabPane) {
              event.acceptTransferModes(TransferMode.MOVE);
              event.consume();
        tabPane.setOnDragDropped(new EventHandler<DragEvent>() {
          @Override
          public void handle(DragEvent event) {
            final Dragboard dragboard = event.getDragboard();
            if (dragboard.hasString()
                && TAB_DRAG_KEY.equals(dragboard.getString())
                && draggingTab.get() != null
                && draggingTab.get().getTabPane() != tabPane) {
              final Tab tab = draggingTab.get();
              tab.getTabPane().getTabs().remove(tab);
              tabPane.getTabs().add(tab);
              event.setDropCompleted(true);
              draggingTab.set(null);
              event.consume();
        return tabPane ;
      private Tab createTab(String text) {
        final Tab tab = new Tab();
        final Label label = new Label(text);
        tab.setGraphic(label);
        label.setOnDragDetected(new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            Dragboard dragboard = label.startDragAndDrop(TransferMode.MOVE);
            ClipboardContent clipboardContent = new ClipboardContent();
            clipboardContent.putString(TAB_DRAG_KEY);
            dragboard.setContent(clipboardContent);
            draggingTab.set(tab);
            event.consume();
        return tab ;

  • Multiple Views of Same Rows from a Tabbed Pane

    I have a Tabbed Pane with several Tabs that access Different Tables. One Table is the child of two different Tables, ie one foreign key on the child that that points to Table A and a second foreign key on the child that points to Table B. I am trying to have a tabbed pane that will show the childs rows one based on the Table A Foreign Key and the second based on the Table B Foreign Key.
    No matter what I have tried, I get only one view from both Tabs. (NOTE: Both of the Tabbed pane that I instantiate from look completly different, ie a different sequence of fields.)
    I have two distinct rowsetinfo's for each tab each with it own distinct Query. I have each MasterLink pointing to the appropriate Master, either Table A or Table B and it doesn't work.
    I have tried to create additional Business components for the second view, but don't know how to link the rowset to the appropriate Business Component, if that's the problem.
    Any help or suggestion would be greatly appreciated, because I'm Lost.

    hi
    i've tried to do that some time ago and i had to give up... unfortunately i think java3D can't use various rendering modes for the same universe
    regards
    GnG

  • Form inside Tabbed Pane

    Hi, I have a JSF Tabbed Pane with 5 tabs and one of the tab's content contains a datascroller with an input text field 'Go To' where the user can enter the page number to jump to. When I hit enter after typing in a page number, it seems like it just refreshes the page (I think it processes as a Tabbed Pane 'tabchangeevent' but in fact it's not). However, after typing in a page number, and manually clicking the 'Go' button, it submits correctly (to the datascroller) and displays the correct content. Any ideas what could be the problem?

    I would try using static, compile time includes rather than runtime includes.

  • Tab pane height minimum / inconsiste​nt behaviour

    Hi,
    I run into a small but annoying issue with tab controls. (LabView2009f2)
    I want to set the height of the tab control as small as possible.
    - Using property nodes (as in attached example) the minimum height is 31 pixels. With 30 pixels and below an error message is shown ("invalid value").
    - Using the property dialog for the tab I can set height to 1 and setting will be accepted. However after re-opening the dialog the height is changed to 5.
    - After manually setting height to 5, the tab height changes back to 31 as soon as any of the tab properties is changed (like number of tabs, their names, and so on...) - annoying!
    - It doesn't matter if I'm using a classic or a modern style tab.
    So my questions:
    Why is the behaviour inconsistent between changing properties manually and programmatically?
    Why does the tab control allow a height of 5 pixels (atleast by manual setting), but doesn't maintain it afterwards?
    The quick&dirty workaround is to draw a decoration above the tab pane, but using just one property node would be much cleaner...
    Message Edited by GerdW on 11-05-2009 01:46 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    TabPaneHeight.vi ‏9 KB

    Hi,
    thank you for descriping your problem so detailed.
    I've told our R&D department about that. If you want to know about the status you can call the NI Support and ask for information on CAR #195219.
    Actually I don't know when this behaviour will be fixed or if there are only a more detailed informations in the documentation with a minimum value for the tab panel height.
    Sorry I can't tell you more about that right now.
    Thanks for reporting this to us.
    Regards,
    Schilli

  • How to set the focus to the tabbed pane title?

    Dear Friends,
    I'm using tabbed pane (JTabbedPane) in my application. I have 2 tabbed panes and each contain some text fields and buttons.
    In first tabbed, I have 2 text fields, OK and Cancel buttons. I have to set the focus to the title of the tabbed pane after it lost focus from the Cancel button (focus has to move from Cancel button to tabbed pane title by pressing tab key).
    Could anyone please tell me how to set the focus to the tabbed pane title?
    Thanks in advance,
    Sathish kumar D

    Thanks for your reply.
    Could you please tell me how to set focus for title of the tabbed pane throug FocusTraversalPolicy?
    because usually we set the focus for the component by requestFocusInWindow().
    for example set focust to the button OK,
    btnOk.requestFocusInWindow()likewise could you tell me how to set focus to Title of the tabbed pane?
    Sathish kumar D

Maybe you are looking for

  • Too many Cursors open error

    I have been getting this error in my Jdeveloper App. ORA-01000 : maximum open cursors exceeded. We have open cursors set at 220. I am using straight JDBC thin to call the database (8.1.5) and have been closing ResultSets the best I can. It happens af

  • Cinema HD Display no longer comes on immediatley when G5 turned on

    My 23" Cinema HD display no longer comes on immediately when I turn my computer on. The screen stays blank for a few minutes, until I press a button on the keyboard. When the screen finally comes on, the set up for a blue tooth keyboard is displayed.

  • Using text in imovie

    I would like to use text on blank backgrounds in imovie with sound. What would be the best way to do this? Importing a pdf is not working. Do I need another program to make the text into a jpeg? Thanks.

  • Sort results in SQL Developer 3.0

    Hi, Looks like still auto sorting results in SQL Developer 3.0 is not supported (I see only sort history). Because of this I am still using 1.5 to look into table content. Would be nice to have this feature back. Thanks

  • Cannot Erase Locked Files on External HD

    I have been trying to back up using Time Machine, but my HD is full. So I erase the contents of the HD (previous Backup) by dragging it to the recycle bin and hitting Empty Recycle bin. This process stops as it encounters 2 locked files (no idea what