Example usage for javax.swing JTabbedPane setBorder

List of usage examples for javax.swing JTabbedPane setBorder

Introduction

In this page you can find the example usage for javax.swing JTabbedPane setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:ch.zhaw.simulation.diagram.charteditor.DefaultPlotEditor.java

/**
 * Standard constructor - constructs a panel for editing the properties of
 * the specified plot.//ww  w .j a  v  a  2s.  c  om
 * <P>
 * In designing the panel, we need to be aware that subclasses of Plot will
 * need to implement subclasses of PlotPropertyEditPanel - so we need to
 * leave one or two 'slots' where the subclasses can extend the user
 * interface.
 * 
 * @param plot
 *            the plot, which should be changed.
 */
public DefaultPlotEditor(Plot plot) {
    this.plotInsets = plot.getInsets();
    this.backgroundPaintSample = new PaintSample(plot.getBackgroundPaint());
    this.outlineStrokeSample = new StrokeSample(plot.getOutlineStroke());
    this.outlinePaintSample = new PaintSample(plot.getOutlinePaint());
    // Disabled because makes no sense for us
    // if (plot instanceof CategoryPlot) {
    // this.plotOrientation = ((CategoryPlot) plot).getOrientation();
    // } else if (plot instanceof XYPlot) {
    // this.plotOrientation = ((XYPlot) plot).getOrientation();
    // }
    if (plot instanceof CategoryPlot) {
        CategoryItemRenderer renderer = ((CategoryPlot) plot).getRenderer();
        if (renderer instanceof LineAndShapeRenderer) {
            LineAndShapeRenderer r = (LineAndShapeRenderer) renderer;
            this.drawLines = BooleanUtilities.valueOf(r.getBaseLinesVisible());
            this.drawShapes = BooleanUtilities.valueOf(r.getBaseShapesVisible());
        }
    } else if (plot instanceof XYPlot) {
        XYItemRenderer renderer = ((XYPlot) plot).getRenderer();
        if (renderer instanceof StandardXYItemRenderer) {
            StandardXYItemRenderer r = (StandardXYItemRenderer) renderer;
            this.drawLines = BooleanUtilities.valueOf(r.getPlotLines());
            this.drawShapes = BooleanUtilities.valueOf(r.getBaseShapesVisible());
        }
    }

    setLayout(new BorderLayout());

    this.availableStrokeSamples = new StrokeSample[4];
    this.availableStrokeSamples[0] = new StrokeSample(null);
    this.availableStrokeSamples[1] = new StrokeSample(new BasicStroke(1.0f));
    this.availableStrokeSamples[2] = new StrokeSample(new BasicStroke(2.0f));
    this.availableStrokeSamples[3] = new StrokeSample(new BasicStroke(3.0f));

    // create a panel for the settings...
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            plot.getPlotType() + localizationResources.getString(":")));

    JPanel general = new JPanel(new BorderLayout());
    general.setBorder(BorderFactory.createTitledBorder(localizationResources.getString("General")));

    JPanel interior = new JPanel(new LCBLayout(7));
    interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    interior.add(new JLabel(localizationResources.getString("Outline_stroke")));

    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (StrokeSample s : this.availableStrokeSamples) {
        model.addElement(s.getStroke());
    }
    this.cbOutlineStroke = new JComboBox(model);
    this.cbOutlineStroke.setSelectedItem(this.outlineStrokeSample.getStroke());
    this.cbOutlineStroke.setRenderer(new StrokeComboboxRenderer());

    interior.add(this.cbOutlineStroke);
    interior.add(new JLabel());

    interior.add(new JLabel(localizationResources.getString("Outline_Paint")));
    JButton button = new JButton(localizationResources.getString("Select..."));
    button.setActionCommand("OutlinePaint");
    button.addActionListener(this);
    interior.add(this.outlinePaintSample);
    interior.add(button);

    interior.add(new JLabel(localizationResources.getString("Background_paint")));
    button = new JButton(localizationResources.getString("Select..."));
    button.setActionCommand("BackgroundPaint");
    button.addActionListener(this);
    interior.add(this.backgroundPaintSample);
    interior.add(button);

    // Disabled because makes no sense for us
    // if (this.plotOrientation != null) {
    // boolean isVertical =
    // this.plotOrientation.equals(PlotOrientation.VERTICAL);
    // int index = isVertical ? ORIENTATION_VERTICAL :
    // ORIENTATION_HORIZONTAL;
    // interior.add(new
    // JLabel(localizationResources.getString("Orientation")));
    // this.orientationCombo = new JComboBox(orientationNames);
    // this.orientationCombo.setSelectedIndex(index);
    // this.orientationCombo.setActionCommand("Orientation");
    // this.orientationCombo.addActionListener(this);
    // interior.add(this.orientationCombo);
    // interior.add(new JPanel());
    // }

    if (this.drawLines != null) {
        interior.add(new JLabel(localizationResources.getString("Draw_lines")));
        this.drawLinesCheckBox = new JCheckBox();
        this.drawLinesCheckBox.setSelected(this.drawLines.booleanValue());
        this.drawLinesCheckBox.setActionCommand("DrawLines");
        this.drawLinesCheckBox.addActionListener(this);
        interior.add(new JPanel());
        interior.add(this.drawLinesCheckBox);
    }

    if (this.drawShapes != null) {
        interior.add(new JLabel(localizationResources.getString("Draw_shapes")));
        this.drawShapesCheckBox = new JCheckBox();
        this.drawShapesCheckBox.setSelected(this.drawShapes.booleanValue());
        this.drawShapesCheckBox.setActionCommand("DrawShapes");
        this.drawShapesCheckBox.addActionListener(this);
        interior.add(new JPanel());
        interior.add(this.drawShapesCheckBox);
    }

    general.add(interior, BorderLayout.NORTH);

    JPanel appearance = new JPanel(new BorderLayout());
    appearance.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    appearance.add(general, BorderLayout.NORTH);

    JTabbedPane tabs = new JTabbedPane();
    tabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    Axis domainAxis = null;
    if (plot instanceof CategoryPlot) {
        domainAxis = ((CategoryPlot) plot).getDomainAxis();
    } else if (plot instanceof XYPlot) {
        domainAxis = ((XYPlot) plot).getDomainAxis();
    }
    this.domainAxisPropertyPanel = DefaultAxisEditor.getInstance(domainAxis);
    if (this.domainAxisPropertyPanel != null) {
        this.domainAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Domain_Axis"), this.domainAxisPropertyPanel);
    }

    Axis rangeAxis = null;
    if (plot instanceof CategoryPlot) {
        rangeAxis = ((CategoryPlot) plot).getRangeAxis();
    } else if (plot instanceof XYPlot) {
        rangeAxis = ((XYPlot) plot).getRangeAxis();
    }

    this.rangeAxisPropertyPanel = DefaultAxisEditor.getInstance(rangeAxis);
    if (this.rangeAxisPropertyPanel != null) {
        this.rangeAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Range_Axis"), this.rangeAxisPropertyPanel);
    }

    tabs.add(localizationResources.getString("Appearance"), appearance);
    panel.add(tabs);

    add(panel);
}

From source file:fr.pasteque.pos.sales.restaurant.JTicketsBagRestaurantMap.java

/** Creates new form JTicketsBagRestaurant */
public JTicketsBagRestaurantMap(AppView app, TicketsEditor panelticket) {

    super(app, panelticket);

    dlReceipts = new DataLogicReceipts();
    dlSales = new DataLogicSales();

    m_restaurantmap = new JTicketsBagRestaurant(app, this);
    m_PlaceCurrent = null;/*from w w  w  .  j a  v  a  2s.  c o  m*/
    m_PlaceClipboard = null;
    customer = null;
    this.floors = new ArrayList<Floor>();
    this.places = new HashMap<String, List<Place>>();
    try {
        ServerLoader loader = new ServerLoader();
        ServerLoader.Response r = loader.read("PlacesAPI", "getAll");
        if (r.getStatus().equals(ServerLoader.Response.STATUS_OK)) {
            JSONArray a = r.getArrayContent();
            for (int i = 0; i < a.length(); i++) {
                JSONObject oFloor = a.getJSONObject(i);
                Floor f = new Floor(oFloor);
                this.floors.add(f);
                this.places.put(f.getID(), new ArrayList<Place>());
                JSONArray aPlaces = oFloor.getJSONArray("places");
                for (int j = 0; j < aPlaces.length(); j++) {
                    Place p = new Place(aPlaces.getJSONObject(j));
                    this.places.get(f.getID()).add(p);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    initComponents();

    // add the Floors containers
    if (this.floors.size() > 1) {
        // A tab container for 2 or more floors
        JTabbedPane jTabFloors = new JTabbedPane();
        jTabFloors.applyComponentOrientation(getComponentOrientation());
        jTabFloors.setBorder(new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)));
        jTabFloors.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        jTabFloors.setFocusable(false);
        jTabFloors.setRequestFocusEnabled(false);
        m_jPanelMap.add(jTabFloors, BorderLayout.CENTER);

        for (Floor f : this.floors) {
            f.getContainer().applyComponentOrientation(getComponentOrientation());
            JScrollPane jScrCont = new JScrollPane();
            jScrCont.applyComponentOrientation(getComponentOrientation());
            JPanel jPanCont = new JPanel();
            jPanCont.applyComponentOrientation(getComponentOrientation());

            jTabFloors.addTab(f.getName(), f.getIcon(), jScrCont);
            jScrCont.setViewportView(jPanCont);
            jPanCont.add(f.getContainer());
        }
    } else if (this.floors.size() == 1) {
        // Just a frame for 1 floor
        Floor f = this.floors.get(0);
        f.getContainer().applyComponentOrientation(getComponentOrientation());

        JPanel jPlaces = new JPanel();
        jPlaces.applyComponentOrientation(getComponentOrientation());
        jPlaces.setLayout(new BorderLayout());
        jPlaces.setBorder(new javax.swing.border.CompoundBorder(
                new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)),
                new javax.swing.border.TitledBorder(f.getName())));

        JScrollPane jScrCont = new JScrollPane();
        jScrCont.applyComponentOrientation(getComponentOrientation());
        JPanel jPanCont = new JPanel();
        jPanCont.applyComponentOrientation(getComponentOrientation());

        // jPlaces.setLayout(new FlowLayout());           
        m_jPanelMap.add(jPlaces, BorderLayout.CENTER);
        jPlaces.add(jScrCont, BorderLayout.CENTER);
        jScrCont.setViewportView(jPanCont);
        jPanCont.add(f.getContainer());
    }

    // Add all the Table buttons.
    for (Floor f : this.floors) {
        List<Place> places = this.places.get(f.getID());
        for (Place pl : places) {
            f.getContainer().add(pl.getButton());
            pl.setButtonBounds();
            pl.getButton().addActionListener(new MyActionListener(pl));
        }
    }

    // Add the reservations panel
    m_jreservations = new JTicketsBagRestaurantRes(app, this);
    add(m_jreservations, "res");
}

From source file:de.tbuchloh.kiskis.gui.SecuredElementView.java

private Component createTabs() {
    final JTabbedPane p = new PersistentTabPane(getClass().getName() + ".bottomFields", //$NON-NLS-1$
            SwingConstants.BOTTOM);
    p.addTab(M.getString("NAME"), createMainTab()); //$NON-NLS-1$
    p.addTab(M.getString("attachments.title"), //$NON-NLS-1$
            _attachmentBox);/*from www. j a va  2s  .  c  om*/
    p.addTab(M.getString("STATISTICS"), //$NON-NLS-1$
            createStatisticTab());
    p.addTab(M.getString("comment_border_title"), //$NON-NLS-1$
            createCommentTab());
    p.setBorder(BorderFactory.createEmptyBorder());
    return createTitledPanel(M.getString("border_title"), p); //$NON-NLS-1$
}

From source file:com.openbravo.pos.sales.restaurant.JRetailTicketsBagRestaurantMap.java

/**
 * Creates new form JTicketsBagRestaurant
 *///  ww w.  jav a  2  s.c o m
public JRetailTicketsBagRestaurantMap(AppView app, RetailTicketsEditor panelticket, String businessType) {

    super(app, panelticket);
    this.m_App = app;
    dlReceipts = (DataLogicReceipts) app.getBean("com.openbravo.pos.sales.DataLogicReceipts");
    dlSales = (DataLogicSales) m_App.getBean("com.openbravo.pos.forms.DataLogicSales");
    dlSystem = (DataLogicSystem) m_App.getBean("com.openbravo.pos.forms.DataLogicSystem");

    m_restaurantmap = new JRetailTicketsBagRestaurant(app, this);
    m_PlaceCurrent = null;
    m_PlaceClipboard = null;
    customer = null;
    //Select all the floor details from db for showing the floor name in screen
    try {
        SentenceList sent = new StaticSentence(app.getSession(),
                "SELECT ID, NAME, IMAGE FROM FLOORS ORDER BY NAME", null, new SerializerReadClass(Floor.class));
        m_afloors = sent.list();

    } catch (BasicException eD) {
        m_afloors = new ArrayList<Floor>();
    }
    //Select all the tables details from db for showing the table names in screen
    try {
        SentenceList sent = new StaticSentence(app.getSession(),
                "SELECT ID, NAME, X, Y, FLOOR FROM PLACES WHERE NAME NOT LIKE 'takeaway' ORDER BY FLOOR", null,
                new SerializerReadClass(Place.class));
        m_aplaces = sent.list();
    } catch (BasicException eD) {
        m_aplaces = new ArrayList<Place>();
    }
    //Initialise the components
    initComponents();

    // add the Floors containers
    if (m_afloors.size() > 1) {
        // A tab container for 2 or more floors
        JTabbedPane jTabFloors = new JTabbedPane();
        jTabFloors.applyComponentOrientation(getComponentOrientation());
        jTabFloors.setBorder(new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)));
        jTabFloors.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        jTabFloors.setFocusable(false);
        jTabFloors.setRequestFocusEnabled(false);
        m_jPanelMap.add(jTabFloors, BorderLayout.CENTER);

        for (Floor f : m_afloors) {
            f.getContainer().applyComponentOrientation(getComponentOrientation());

            JScrollPane jScrCont = new JScrollPane();
            jScrCont.applyComponentOrientation(getComponentOrientation());
            JPanel jPanCont = new JPanel();
            jPanCont.applyComponentOrientation(getComponentOrientation());

            jTabFloors.addTab(f.getName(), f.getIcon(), jScrCont);
            jScrCont.setViewportView(jPanCont);
            jPanCont.add(f.getContainer());
        }
    } else if (m_afloors.size() == 1) {
        // Just a frame for 1 floor
        Floor f = m_afloors.get(0);
        f.getContainer().applyComponentOrientation(getComponentOrientation());

        JPanel jPlaces = new JPanel();
        jPlaces.applyComponentOrientation(getComponentOrientation());
        jPlaces.setLayout(new BorderLayout());

        jPlaces.setBorder(new javax.swing.border.CompoundBorder(
                new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)),
                new javax.swing.border.TitledBorder(f.getName())));
        JScrollPane jScrCont = new JScrollPane();
        jScrCont.applyComponentOrientation(getComponentOrientation());
        JPanel jPanCont = new JPanel();
        jPanCont.applyComponentOrientation(getComponentOrientation());
        m_jPanelMap.add(jPlaces, BorderLayout.CENTER);
        jPlaces.add(jScrCont, BorderLayout.CENTER);
        jScrCont.setViewportView(jPanCont);
        jPanCont.add(f.getContainer());
    }

    // Add all the Table buttons.
    Floor currfloor = null;

    for (Place pl : m_aplaces) {
        int iFloor = 0;

        if (currfloor == null || !currfloor.getID().equals(pl.getFloor())) {
            // Look for a new floor
            do {
                currfloor = m_afloors.get(iFloor++);
            } while (!currfloor.getID().equals(pl.getFloor()));
        }

        currfloor.getContainer().add(pl.getButton());
        pl.setButtonBounds();
        pl.getButton().addActionListener(new MyActionListener(pl));
    }

    // Add the reservations panel
    m_jreservations = new JRetailTicketsBagRestaurantRes(app, this);
    add(m_jreservations, "res");
}

From source file:org.jfree.chart.demo.SuperDemo.java

private JComponent createContent() {
    JPanel jpanel = new JPanel(new BorderLayout());
    JTabbedPane jtabbedpane = new JTabbedPane();
    JPanel jpanel1 = new JPanel(new BorderLayout());
    jpanel1.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    JSplitPane jsplitpane = new JSplitPane(1);
    JTree jtree = new JTree(createTreeModel());
    jtree.addTreeSelectionListener(this);
    JScrollPane jscrollpane = new JScrollPane(jtree);
    jscrollpane.setPreferredSize(new Dimension(300, 100));
    jsplitpane.setLeftComponent(jscrollpane);
    jsplitpane.setRightComponent(createChartDisplayPanel());
    jpanel1.add(jsplitpane);//from  www.j av a  2 s .c o  m
    jtabbedpane.add("Demos", jpanel1);
    MemoryUsageDemo memoryusagedemo = new MemoryUsageDemo(0x493e0);
    (memoryusagedemo.new DataGenerator(1000)).start();//memoryusagedemo, 
    jtabbedpane.add("Memory Usage", memoryusagedemo);
    jtabbedpane.add("Source Code", createSourceCodePanel());
    jtabbedpane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    jpanel.add(jtabbedpane);
    return jpanel;
}

From source file:net.pms.newgui.LooksFrame.java

public JComponent buildMain() {
    final JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);

    tabbedPane.setUI(new CustomTabbedPaneUI());

    st = new StatusTab(configuration);
    tt = new TracesTab(configuration, this);
    gt = new GeneralTab(configuration, this);
    nt = new NavigationShareTab(configuration, this);
    tr = new TranscodingTab(configuration, this);
    ht = new HelpTab();

    tabbedPane.addTab(Messages.getString("LooksFrame.18"), st.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.19"), tt.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.20"), gt.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.22"), nt.build());
    if (!configuration.isDisableTranscoding()) {
        tabbedPane.addTab(Messages.getString("LooksFrame.21"), tr.build());
    } else {/*from w w  w .ja  v  a 2s.  com*/
        tr.build();
    }
    tabbedPane.addTab(Messages.getString("LooksFrame.24"), new HelpTab().build());
    tabbedPane.addTab(Messages.getString("LooksFrame.25"), new AboutTab().build());

    tabbedPane.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            int selectedIndex = tabbedPane.getSelectedIndex();

            if (HELP_PAGES[selectedIndex] != null) {
                PMS.setHelpPage(HELP_PAGES[selectedIndex]);

                // Update the contents of the help tab itself
                ht.updateContents();
            }
        }
    });

    tabbedPane.setBorder(new EmptyBorder(5, 5, 5, 5));

    /*
     * Set the orientation of the tabbedPane.
     * Note: Do not use applyComponentOrientation() here because it
     * messes with the layout of several tabs.
     */
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());
    tabbedPane.setComponentOrientation(orientation);

    return tabbedPane;
}

From source file:org.stanwood.swing.AboutDialog.java

public void init() {
    Box box = Box.createVerticalBox();
    if (icon == null) {
        createTitleArea(box, title, version);
    } else {/*w ww. java 2s . c  o  m*/
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(40));
        hbox.add(new JLabel(icon));
        hbox.add(Box.createHorizontalStrut(10));
        box.add(hbox);
        Box vbox = Box.createVerticalBox();
        createTitleArea(vbox, title, version);
        hbox.add(vbox);
        hbox.add(Box.createHorizontalGlue());
    }

    JTabbedPane infoTabbedPane = new JTabbedPane();
    infoTabbedPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JComponent tabAbout = createAboutTab();
    infoTabbedPane.addTab("About", tabAbout);
    JComponent tabAuthors = createAuthorsTab();
    infoTabbedPane.addTab("Authors", tabAuthors);
    box.add(infoTabbedPane);
    createButtonPane(box);

    setContentPane(box);
    setSize(450, 280);
    setLocationRelativeTo(getParent());
}