use of javax.swing.UIManager.LookAndFeelInfo in project sonarqube by SonarSource.
the class ScannerReportViewerApp method initialize.
/**
* Initialize the contents of the frame.
*/
private void initialize() {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
splitPane = new JSplitPane();
frame.getContentPane().add(splitPane, BorderLayout.CENTER);
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setPreferredSize(new Dimension(500, 7));
splitPane.setRightComponent(tabbedPane);
componentDetailsTab = new JScrollPane();
tabbedPane.addTab("Component details", null, componentDetailsTab, null);
componentEditor = new JEditorPane();
componentDetailsTab.setViewportView(componentEditor);
sourceTab = new JScrollPane();
tabbedPane.addTab("Source", null, sourceTab, null);
sourceEditor = createSourceEditor();
sourceEditor.setEditable(false);
sourceTab.setViewportView(sourceEditor);
textLineNumber = createTextLineNumber();
sourceTab.setRowHeaderView(textLineNumber);
highlightingTab = new JScrollPane();
tabbedPane.addTab("Highlighting", null, highlightingTab, null);
highlightingEditor = new JEditorPane();
highlightingTab.setViewportView(highlightingEditor);
symbolTab = new JScrollPane();
tabbedPane.addTab("Symbol references", null, symbolTab, null);
symbolEditor = new JEditorPane();
symbolTab.setViewportView(symbolEditor);
coverageTab = new JScrollPane();
tabbedPane.addTab("Coverage", null, coverageTab, null);
coverageEditor = new JEditorPane();
coverageTab.setViewportView(coverageEditor);
duplicationTab = new JScrollPane();
tabbedPane.addTab("Duplications", null, duplicationTab, null);
duplicationEditor = new JEditorPane();
duplicationTab.setViewportView(duplicationEditor);
testsTab = new JScrollPane();
tabbedPane.addTab("Tests", null, testsTab, null);
testsEditor = new JEditorPane();
testsTab.setViewportView(testsEditor);
issuesTab = new JScrollPane();
tabbedPane.addTab("Issues", null, issuesTab, null);
issuesEditor = new JEditorPane();
issuesTab.setViewportView(issuesEditor);
externalIssuesTab = new JScrollPane();
tabbedPane.addTab("External Issues", null, externalIssuesTab, null);
externalIssuesEditor = new JEditorPane();
externalIssuesTab.setViewportView(externalIssuesEditor);
measuresTab = new JScrollPane();
tabbedPane.addTab("Measures", null, measuresTab, null);
measuresEditor = new JEditorPane();
measuresTab.setViewportView(measuresEditor);
scmTab = new JScrollPane();
tabbedPane.addTab("SCM", null, scmTab, null);
scmEditor = new JEditorPane();
scmTab.setViewportView(scmEditor);
activeRuleTab = new JScrollPane();
tabbedPane.addTab("Active Rules", null, activeRuleTab, null);
activeRuleEditor = new JEditorPane();
activeRuleTab.setViewportView(activeRuleEditor);
adHocRuleTab = new JScrollPane();
tabbedPane.addTab("Add Hoc Rules", null, adHocRuleTab, null);
adHocRuleEditor = new JEditorPane();
adHocRuleTab.setViewportView(adHocRuleEditor);
qualityProfileTab = new JScrollPane();
tabbedPane.addTab("Quality Profiles", null, qualityProfileTab, null);
qualityProfileEditor = new JEditorPane();
qualityProfileTab.setViewportView(qualityProfileEditor);
pluginTab = new JScrollPane();
tabbedPane.addTab("Plugins", null, pluginTab, null);
pluginEditor = new JEditorPane();
pluginTab.setViewportView(pluginEditor);
cpdTextBlocksTab = new JScrollPane();
tabbedPane.addTab("CPD Text Blocks", null, cpdTextBlocksTab, null);
cpdTextBlocksEditor = new JEditorPane();
cpdTextBlocksTab.setViewportView(cpdTextBlocksEditor);
significantCodeTab = new JScrollPane();
tabbedPane.addTab("Significant Code Ranges", null, significantCodeTab, null);
significantCodeEditor = new JEditorPane();
significantCodeTab.setViewportView(significantCodeEditor);
metadataTab = new JScrollPane();
tabbedPane.addTab("Metadata", null, metadataTab, null);
metadataEditor = new JEditorPane();
metadataTab.setViewportView(metadataEditor);
treeScrollPane = new JScrollPane();
treeScrollPane.setPreferredSize(new Dimension(200, 400));
splitPane.setLeftComponent(treeScrollPane);
componentTree = new JTree();
componentTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("empty") {
{
}
}));
treeScrollPane.setViewportView(componentTree);
componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
componentTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) componentTree.getLastSelectedPathComponent();
if (node == null) {
// Nothing is selected.
return;
}
frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
updateDetails((Component) node.getUserObject());
frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
});
frame.pack();
}
Aggregations