public void initComponents() { // setting frame setTitle("Opcje"); setResizable(false); setDefaultCloseOperation(WebFrame.DISPOSE_ON_CLOSE); setRound(10); setShadeWidth(0); ComponentMoveAdapter.install(this); setShowMinimizeButton(false); // creating tab pane tabGroupPane = new WebTabbedPane(); tabGroupPane.setTabPlacement(WebTabbedPane.TOP); tabGroupPane.setTabbedPaneStyle(TabbedPaneStyle.standalone); tabGroupPane.setRound(10); tabGroupPane.setFocusable(false); // content border final TitledBorderPainter titledBorderPainter = new TitledBorderPainter(); titledBorderPainter.setTitleOffset(10); titledBorderPainter.setRound(Math.max(0, 8)); titledBorderPainter.setMargin(10); titledBorderPainter.setWidth(0); // this.setPainter(titledBorderPainter); // adding main options tab mainOptionsTab = new MainOptionsTab(); mainOptionsTab.setPainter(titledBorderPainter); tabGroupPane.add(mainOptionsTab); // adding notification options tab notificationsOptionTab = new NotificationsOptionTab(); notificationsOptionTab.setPainter(titledBorderPainter); tabGroupPane.add(notificationsOptionTab); add(tabGroupPane); // inside padding tabGroupPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // -------------------------------FINAL-------------------------------// setBounds(new Rectangle(getPreferredSize())); // getting windows size Dimension scrnSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = (int) scrnSize.getWidth(); int height = (int) scrnSize.getHeight(); // getting taksbar size Rectangle winSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); int taskBarHeight = scrnSize.height - winSize.height; // setting ui location on screen int xLocation = (width - (int) getPreferredSize().getWidth()) / 2; int yLocation = (height - (int) getPreferredSize().getHeight() - taskBarHeight) / 2; setLocation(xLocation, yLocation); }
public static WebTabbedPane createExampleTabs(WebLookAndFeelDemo owner, WebProgressDialog load) { // All example groups load.setText("Loading groups list"); List<ExampleGroup> exampleGroups = getExampleGroups(); load.setMinimum(0); load.setMaximum(exampleGroups.size() + 1); load.setProgress(0); // Example tabs WebTabbedPane exampleTabs = new WebTabbedPane(); exampleTabs.setTabbedPaneStyle(TabbedPaneStyle.attached); // exampleTabs.setTabLayoutPolicy ( WebTabbedPane.SCROLL_TAB_LAYOUT ); // Progress component IconProgress ip = (IconProgress) load.getMiddleComponent(); // Creating all examples int progress = 1; for (ExampleGroup group : exampleGroups) { // Updating progress state load.setText("Loading group: " + group.getGroupName()); load.setProgress(progress); progress++; // Updating progress icons Icon gi = group.getGroupIcon(); ip.addLoadedElement(gi); // Adding group view to new tab exampleTabs.addTab(group.getGroupName(), gi, createGroupView(owner, group)); // Applying foreground settings exampleTabs.setSelectedForegroundAt( exampleTabs.getTabCount() - 1, group.getPreferredForeground()); // Applying specific group settings to tab group.modifyExampleTab(exampleTabs.getTabCount() - 1, exampleTabs); } load.setProgress(progress); return exampleTabs; }