private QueryStatisticsPanel addDMLStatsTab( @NotNull Content content, SqlStatementMarker sqlMarker, Icon icon, String s) { // Component[] comps = (content.getComponent()).getComponents(); // JTabbedPane tabbedPane = (JTabbedPane) comps[1]; JTabbedPane tabbedPane = getTabComponent(content); QueryStatisticsPanel dmlStatsPanel = new QueryStatisticsPanel(); dmlStatsPanel.putClientProperty(CREATE_TIME, new Date().getTime()); tabbedPane.addTab(sqlMarker.getName(), dmlStatsPanel); int index = tabbedPane.indexOfTab(sqlMarker.getName()); tabbedPane.setTabComponentAt(index, new ButtonTabComponent(tabbedPane, icon, sqlMarker)); return dmlStatsPanel; }
private DataGridPanel addGridPanelTab( @NotNull Content content, SqlStatementMarker sqlMarker, Icon icon, String toolTip) { JTabbedPane tabbedPane = getTabComponent(content); DataGridPanel dataGridPanel = new DataGridPanel(); dataGridPanel.putClientProperty(CREATE_TIME, new Date().getTime()); tabbedPane.addTab(sqlMarker.getName(), dataGridPanel); int index = tabbedPane.indexOfTab(sqlMarker.getName()); ButtonTabComponent buttonTab = new ButtonTabComponent(tabbedPane, icon, sqlMarker); if (toolTip != null) { buttonTab.setToolTipText(toolTip); } tabbedPane.setTabComponentAt(index, buttonTab); return dataGridPanel; }
private void makeAndSetTabComponents() { final String[] tabTitles = {"Libraries", "Modes", "Tools", "Examples", "Updates"}; tabLabels = new JLabel[4]; for (int i = 0; i < 4; i++) { final int temp = i; tabLabels[i] = new JLabel(tabTitles[i]) { @Override protected void paintComponent(Graphics g) { g.setClip( Toolkit.createRoundRect( 0, 0, getWidth(), getHeight(), temp == 0 ? 6 : 0, temp == 3 ? 6 : 0, 0, 0)); super.paintComponent(g); } }; tabLabels[i].setForeground(Color.WHITE); tabLabels[i].setBackground(new Color(0x2d4251)); tabLabels[i].setOpaque(true); tabLabels[i].setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); tabLabels[i].setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT)); tabLabels[i].setHorizontalAlignment(SwingConstants.CENTER); tabLabels[i].setFont(Toolkit.getSansFont(14, Font.BOLD)); tabbedPane.setTabComponentAt(i, tabLabels[i]); } updateTabPanel = new JPanel() { @Override protected void paintComponent(Graphics g) { g.setClip(Toolkit.createRoundRect(0, 0, getWidth(), getHeight(), 6, 6, 0, 0)); super.paintComponent(g); } }; ; updateTabLabel = new JLabel("Updates"); updateTabLabel.setFont(Toolkit.getSansFont(14, Font.BOLD)); numberLabel.setVerticalTextPosition(SwingConstants.CENTER); numberLabel.setHorizontalTextPosition(SwingConstants.CENTER); numberLabel.setFont(Toolkit.getSansFont(14, Font.BOLD)); numberLabel.setForeground(Color.WHITE); updateTabPanel.setOpaque(true); updateTabPanel.setBackground(new Color(0x2d4251)); updateTabLabel.setForeground(Color.WHITE); updateTabPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); updateTabPanel.setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT)); tabbedPane.setTabComponentAt(4, updateTabPanel); GroupLayout tabLayout = new GroupLayout(updateTabPanel); tabLayout.setAutoCreateGaps(true); updateTabPanel.setLayout(tabLayout); tabLayout.setHorizontalGroup( tabLayout .createSequentialGroup() .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(updateTabLabel) .addComponent(numberLabel) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); tabLayout.setVerticalGroup( tabLayout .createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(numberLabel) .addComponent(updateTabLabel)); numberLabel.setVisible(false); }