下面列出了javax.swing.JSplitPane#setBorder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void buildVectorViewer() {
JPanel panel = new JPanel(new BorderLayout());
JSplitPane splitter = new JSplitPane();
splitter.setContinuousLayout(true);
splitter.setResizeWeight(0.75);
splitter.setBorder(null);
VectorContentViewer contentViewer = new VectorContentViewer(mData, this);
JScrollPane scroller = new JScrollPane(contentViewer);
scroller.setOpaque(false);
scroller.setBorder(null);
scroller.getViewport().setBorder(null);
scroller.getViewport().setOpaque(false);
splitter.setLeftComponent(scroller);
mImageViewer = new VectorImageViewer(mData);
splitter.setRightComponent(mImageViewer);
panel.add(splitter, BorderLayout.CENTER);
add(panel);
}
protected TreeView initGui () {
TTW retVal = new TTW () ;
split = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT);
PropertySheetView propertyView = new PropertySheetView();
split.setLeftComponent(retVal);
split.setRightComponent(propertyView);
// install proper border for split pane
split.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N
setLayout (new java.awt.GridBagLayout ());
GridBagConstraints gridBagConstraints = new GridBagConstraints ();
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.gridwidth = 2;
add (split, gridBagConstraints);
return retVal;
}
/**
* Creates a new {@code CSSStylesSelectionPanel}.
*/
CSSStylesSelectionPanel() {
setLayout(new BorderLayout());
JSplitPane splitPane = createSplitPane();
splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
splitPane.setTopComponent(initPropertyPane());
splitPane.setBottomComponent(initRulePane());
splitPane.setDividerSize(4);
splitPane.setResizeWeight(0.5);
splitPane.setBorder(null);
selectionView = splitPane;
initMessagePanel();
initSelectionOfOwningRule();
add(selectionView, BorderLayout.CENTER);
updateContent(null, false);
}
private static JPanel createTypePanels(final JFrame parent, final CGraphModel model,
final TypeManager typeManager) {
final JPanel typePanel = new JPanel(new BorderLayout());
final JPanel typeEditorPanel = TypeEditorPanel.CreateDefaultTypeEditor(parent, typeManager);
if (isFunctionFlowgraph(model)) {
final JSplitPane splitPaneTop = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPaneTop.setBorder(BorderFactory.createEmptyBorder());
splitPaneTop.setOneTouchExpandable(true);
final JSplitPane splitPaneBottom = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPaneBottom.setBorder(BorderFactory.createEmptyBorder());
splitPaneBottom.setOneTouchExpandable(true);
splitPaneTop.setTopComponent(createPrototypePanel(parent, model, typeManager));
splitPaneTop.setBottomComponent(createStackFramePanel(parent, model, typeManager));
splitPaneBottom.setTopComponent(splitPaneTop);
splitPaneBottom.setBottomComponent(typeEditorPanel);
typePanel.add(splitPaneBottom);
} else {
typePanel.add(typeEditorPanel, BorderLayout.CENTER);
}
return typePanel;
}
private void removeSplitPaneBorders(JSplitPane pane) {
pane.setUI(new BasicSplitPaneUI() {
@Override
public BasicSplitPaneDivider createDefaultDivider() {
return new BasicSplitPaneDivider(this) {
@Override
public void setBorder(Border b) {
}
};
}
});
pane.setBorder(new EmptyBorder(3, 3, 3, 3));
}
public JPanel get() {
JPanel panel = new JPanel(new GridLayout(1, 1));
panel.setOpaque(false);
panel.setBorder(BorderFactory.createLineBorder(Color.gray));
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, initUpperPanel(), initLowerPanel());
splitPane.setOpaque(false);
splitPane.setBorder(BorderFactory.createEmptyBorder());
splitPane.setDividerLocation(120);
panel.add(splitPane);
return panel;
}
private void situateElongated() {
JSplitPane xx1 = new Split(.8, JSplitPane.VERTICAL_SPLIT);
xx1.setDividerSize(6);
xx1.setResizeWeight(.8);
JPanel cp = new JPanel(new BorderLayout());
cp.add(sp);
cp.add(errorStrip, BorderLayout.LINE_END);
cp.setBorder(BorderFactory.createEtchedBorder());
xx1.add(cp);
xx1.add(respAreaX);
xx1.setBorder(BorderFactory.createEmptyBorder());
JComponent newtop = xx1;
if (enable_outline) {
JSplitPane xx2 = new Split(.33, JSplitPane.HORIZONTAL_SPLIT);
xx2.setDividerSize(6);
if (outline_on_left) {
xx2.setResizeWeight(.33);
xx2.add(p);
xx2.add(xx1);
} else {
xx2 = new Split(.6, JSplitPane.HORIZONTAL_SPLIT);
xx2.setDividerSize(6);
xx2.setResizeWeight(.66);
xx2.add(xx1);
xx2.add(p);
}
xx2.setBorder(BorderFactory.createEmptyBorder());
newtop = xx2;
}
this.removeAll();
add(newtop);
revalidate();
}
private void situateNotElongated() {
JPanel cp = new JPanel(new BorderLayout());
cp.add(sp);
cp.add(errorStrip, BorderLayout.LINE_END);
cp.setBorder(BorderFactory.createEtchedBorder());
JComponent newtop = cp;
if (enable_outline) {
JSplitPane xx2 = new Split(.8, JSplitPane.HORIZONTAL_SPLIT);
xx2.setDividerSize(6);
if (outline_on_left) {
xx2.setResizeWeight(.2);
xx2.add(p);
xx2.add(cp);
} else {
xx2.setResizeWeight(.8);
xx2.add(cp);
xx2.add(p);
}
xx2.setBorder(BorderFactory.createEmptyBorder());
newtop = xx2;
}
JSplitPane xx1 = new Split(.8, JSplitPane.VERTICAL_SPLIT);
xx1.setDividerSize(6);
xx1.setResizeWeight(.8);
xx1.add(newtop);
xx1.add(respAreaX);
xx1.setBorder(BorderFactory.createEmptyBorder());
respAreaX.setMinimumSize(new Dimension(0, 0));
this.removeAll();
add(xx1);
revalidate();
}
private JSplitPane addTicPlot(PeakListRow row) {
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// labels for TIC visualizer
Map<Feature, String> labelsMap = new HashMap<Feature, String>(0);
// scan selection
ScanSelection scanSelection = new ScanSelection(rawFiles[0].getDataRTRange(1), 1);
// mz range
Range<Double> mzRange = null;
mzRange = feature.getRawDataPointsMZRange();
// optimize output by extending the range
double upper = mzRange.upperEndpoint();
double lower = mzRange.lowerEndpoint();
double fiveppm = (upper * 5E-6);
mzRange = Range.closed(lower - fiveppm, upper + fiveppm);
// labels
labelsMap.put(feature, feature.toString());
TICVisualizerWindow window = new TICVisualizerWindow(rawFiles, // raw
TICPlotType.BASEPEAK, // plot type
scanSelection, // scan selection
mzRange, // mz range
row.getPeaks(), // selected features
labelsMap); // labels
pane.add(window.getTICPlot());
pane.add(window.getToolBar());
pane.setResizeWeight(1);
pane.setDividerSize(1);
pane.setBorder(BorderFactory.createLineBorder(Color.black));
return pane;
}
private void tweakSplitPaneUI(JSplitPane splitPane) {
splitPane.setOpaque(false);
splitPane.setBorder(null);
splitPane.setDividerSize(3);
if (!(splitPane.getUI() instanceof BasicSplitPaneUI)) {
return;
}
BasicSplitPaneDivider divider = ((BasicSplitPaneUI) splitPane.getUI()).getDivider();
if (divider != null) {
divider.setBorder(null);
}
}
private static void tweakSplitPaneUI(JSplitPane splitPane) {
splitPane.setOpaque(false);
splitPane.setBorder(null);
splitPane.setDividerSize(3);
if (!(splitPane.getUI() instanceof BasicSplitPaneUI)) {
return;
}
BasicSplitPaneDivider divider = ((BasicSplitPaneUI) splitPane.getUI()).getDivider();
if (divider != null) {
divider.setBorder(null);
}
}
private Container getMainContentContainer() {
// card pool
cardPoolDefs = filterPanel.getFilteredCards();
cardPoolTable = new CardTablePanelB(cardPoolDefs, generatePoolTitle(), false);
cardPoolTable.addMouseListener(new CardPoolMouseListener());
cardPoolTable.addCardSelectionListener(this);
cardPoolTable.setDeckEditorSelectionMode();
deckDefs = this.deck;
deckTable = new CardTablePanelB(deckDefs, generateDeckTitle(deckDefs), true);
deckTable.addMouseListener(new DeckMouseListener());
deckTable.addCardSelectionListener(this);
deckTable.setDeckEditorSelectionMode();
deckTable.showCardCount(true);
final JPanel deckPanel = new JPanel();
deckPanel.setOpaque(false);
deckPanel.setLayout(new MigLayout("insets 0, gap 0, flowy"));
deckPanel.add(buttonsPanel, "w 100%, h 40!");
deckPanel.add(deckTable, "w 100%, h 100%");
cardsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
cardsSplitPane.setOneTouchExpandable(false);
cardsSplitPane.setLeftComponent(cardPoolTable);
cardsSplitPane.setRightComponent(deckPanel);
cardsSplitPane.setResizeWeight(0.5);
cardsSplitPane.setDividerSize(14);
cardsSplitPane.setBorder(null);
cardsSplitPane.setOpaque(false);
cardsSplitPane.setDividerLocation(getDividerPosition());
// update deck stats
sideBarPanel.setDeck(this.deck);
return cardsSplitPane;
}
private void defineLayout ()
{
/*
* +=============================================================+
* |toolKeyPanel . . . . . . . . . . . . . . . . . . . . . . . . |
* |+=================+=============================+===========+|
* || toolBar . . . . . . . . . .| progressBar . . .| Memory . .||
* |+=================+=============================+===========+|
* +=============================================================+
* | horiSplitPane . . . . . . . . . . . . . . . . . . . . . . . |
* |+=========================================+=================+|
* | . . . . . . . . . . . . . . . . . . . . .|boardsScrollPane ||
* | +========================================+ . . . . . . . . ||
* | | sheetController . . . . . . . . . . . .| . . . . . . . . ||
* | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |v| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |e| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |r| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |t| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |S| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |p| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |l| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |i| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |t| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
* |P+=====================+==================+ . . . . . . . . ||
* |a| logPane . . . . . . | errors . . . . . | . . . . . . . . ||
* |n| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
* |e| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
* | +=====================+==================+=================+|
* +=============================================================+
*/
// Individual panes
logPane = new LogPane();
boardsScrollPane = new BoardsScrollPane();
boardsScrollPane.setPreferredSize(new Dimension(350, 500));
// Bottom = Log & Errors
bottomPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
bottomPane.setBorder(null);
bottomPane.setDividerSize(1);
bottomPane.setResizeWeight(0.5d); // Cut in half initially
// mainPane = sheetsController / bottomPane
mainPane = new JSplitPane(
JSplitPane.VERTICAL_SPLIT,
sheetsController.getComponent(),
null);
mainPane.setBorder(null);
mainPane.setDividerSize(1);
mainPane.setResizeWeight(0.9d); // Give bulk space to upper part
// horiSplitPane = mainPane | boards
appPane = new Panel();
appPane.setNoInsets();
appPane.setBorder(null);
appPane.setLayout(new BorderLayout());
appPane.add(mainPane, BorderLayout.CENTER); // + boardsScrollPane later
appPane.setName("appPane");
// Global layout: Use a toolbar on top and a double split pane below
///toolBar.add(toolKeyPanel);
Container content = frame.getContentPane();
content.setLayout(new BorderLayout());
content.add(
ActionManager.getInstance().getToolBar(),
BorderLayout.NORTH);
content.add(appPane, BorderLayout.CENTER);
// Suppress all internal borders, recursively
///UIUtilities.suppressBorders(frame.getContentPane());
// Display the boards pane?
if (GuiActions.getInstance()
.isBoardsDisplayed()) {
appPane.add(boardsScrollPane, BorderLayout.EAST);
}
// Display the log pane?
if (GuiActions.getInstance()
.isLogDisplayed()) {
bottomPane.setLeftComponent(logPane.getComponent());
}
// Display the errors pane?
if (GuiActions.getInstance()
.isErrorsDisplayed()) {
bottomPane.setRightComponent(null);
}
// BottomPane = Log & Errors
if (needBottomPane()) {
mainPane.setBottomComponent(bottomPane);
}
}
/**
* Creates a new pathfinding dialog object.
*
* @param module The module that provides the basic blocks to choose from.
*/
public PathfindingDialog(final JFrame parent, final Module module) {
super(parent, "Pathfinding", true);
// Provide ESC key functionality
new CDialogEscaper(this);
// Create the GUI
setLayout(new BorderLayout());
final JPanel topPanel = new JPanel(new BorderLayout());
// This tree is used to select the start block.
startBlockTree = new FunctionTree(this, module);
// This tree is used to select the end block.
endBlockTree = new FunctionTree(this, module);
// This field is used to display the assembler code of
// the selected start block.
final JTextArea startBlockAsmField = createAsmField();
// This field is used to display the assembler code of
// the selected end block.
final JTextArea endBlockAsmField = createAsmField();
final JTextArea searchFieldStart = new JTextArea(1, 10);
final JTextArea searchFieldEnd = new JTextArea(1, 10);
searchFieldStart.getDocument()
.addDocumentListener(new InternalDocumentListener(startBlockTree));
searchFieldEnd.getDocument().addDocumentListener(new InternalDocumentListener(endBlockTree));
// Listeners to update the assembler fields when the selection changes.
startBlockTree.addTreeSelectionListener(new InternalTreeSelectionListener(startBlockAsmField));
endBlockTree.addTreeSelectionListener(new InternalTreeSelectionListener(endBlockAsmField));
final JSplitPane splitPaneSearch = new JSplitPane(
JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(searchFieldStart),
new JScrollPane(searchFieldEnd));
splitPaneSearch.setResizeWeight(0.5);
final JSplitPane splitPane = new JSplitPane(
JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(startBlockTree),
new JScrollPane(endBlockTree));
splitPane.setResizeWeight(0.5);
final JPanel upperPanel = new JPanel(new BorderLayout());
upperPanel.add(splitPane);
upperPanel.add(splitPaneSearch, BorderLayout.NORTH);
final JPanel previewPanel = new JPanel(new BorderLayout());
final JSplitPane splitPane2 = new JSplitPane(
JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(startBlockAsmField),
new JScrollPane(endBlockAsmField));
splitPane2.setResizeWeight(0.5);
previewPanel.add(splitPane2);
upperPanel.add(previewPanel, BorderLayout.SOUTH);
topPanel.add(upperPanel);
splitPane.setBorder(new EmptyBorder(5, 5, 5, 5));
add(topPanel, BorderLayout.CENTER);
add(new CPanelTwoButtons(m_listener, "OK", "Cancel"), BorderLayout.SOUTH);
setPreferredSize(new Dimension(800, 500));
pack();
}
public AssociationRuleTableViewer(AssociationRules rules) {
if (rules != null && rules.getNumberOfRules() > 0) {
this.model = new AssociationRuleTableModel(rules);
setLayout(new BorderLayout());
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setBorder(null);
// conclusion list
AssociationRuleFilter filter = new AssociationRuleFilter(rules);
filter.addAssociationRuleFilterListener(this);
filter.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
splitPane.add(filter, 0);
// main panel
{
JPanel mainPanel = new JPanel();
mainPanel.setOpaque(true);
mainPanel.setBackground(Colors.WHITE);
GridBagLayout layout = new GridBagLayout();
mainPanel.setLayout(layout);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.insets = new Insets(15, 10, 10, 10);
table.setModel(model);
table.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT);
table.setRowHighlighting(true);
table.setAutoResizeMode(ExtendedJTable.AUTO_RESIZE_OFF);
JScrollPane tablePane = new ExtendedJScrollPane(table);
tablePane.setBorder(null);
tablePane.setBackground(Colors.WHITE);
tablePane.getViewport().setBackground(Colors.WHITE);
layout.setConstraints(tablePane, c);
mainPanel.add(tablePane);
setColumnSizes();
splitPane.add(mainPanel, 1);
table.getTableHeader().setBackground(Colors.WHITE);
table.getTableHeader().putClientProperty(RapidLookTools.PROPERTY_TABLE_HEADER_BACKGROUND, Colors.WHITE);
}
filter.triggerFilter();
add(splitPane, BorderLayout.CENTER);
} else {
add(ResultDisplayTools.createErrorComponent("No rules found"), BorderLayout.CENTER);
}
}
private void defineLayout ()
{
// +=============================================================+
// |toolKeyPanel . . . . . . . . . . . . . . . . . . . . . . . . |
// |+=================+=============================+===========+|
// || toolBar . . . . . . . . . .| progressBar . . .| Memory . .||
// |+=================+=============================+===========+|
// +=============================================================+
// | horiSplitPane . . . . . . . . . . . . . . . . . . . . . . . |
// |+=========================================+=================+|
// | . . . . . . . . . . . . . . . . . . . . .|boardsScrollPane ||
// | +========================================+ . . . . . . . . ||
// | | stubsController . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |m| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |a| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |i| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |n| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |P+=====================+==================+ . . . . . . . . ||
// |a| logPane . . . . . . | errors . . . . . | . . . . . . . . ||
// |n| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
// |e| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
// | +=====================+==================+=================+|
// +=============================================================+
//
// Individual panes
logPane = new LogPane();
boardsScrollPane = new BoardsScrollPane();
boardsScrollPane.setPreferredSize(new Dimension(350, 500));
// Bottom = Log & Errors
bottomPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
bottomPane.setBorder(null);
bottomPane.setDividerSize(1);
bottomPane.setResizeWeight(0.5d); // Cut in half initially
// mainPane = stubsController / bottomPane
mainPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, stubsController.getComponent(), null);
mainPane.setBorder(null);
mainPane.setOneTouchExpandable(true);
mainPane.setResizeWeight(0.9d); // Give bulk space to upper part
// horiSplitPane = mainPane | boards
appPane = new Panel();
appPane.setNoInsets();
appPane.setBorder(null);
appPane.setLayout(new BorderLayout());
appPane.add(mainPane, BorderLayout.CENTER); // + boardsScrollPane later
appPane.setName("appPane");
// Global layout: Use a toolbar on top and a double split pane below
///toolBar.add(toolKeyPanel);
Container content = frame.getContentPane();
content.setLayout(new BorderLayout());
content.add(ActionManager.getInstance().getToolBar(), BorderLayout.NORTH);
content.add(appPane, BorderLayout.CENTER);
// Display the boards pane?
if (GuiActions.getInstance().isBoardsWindowDisplayed()) {
appPane.add(boardsScrollPane, BorderLayout.EAST);
}
// Display the log pane?
if (GuiActions.getInstance().isLogWindowDisplayed()) {
bottomPane.setLeftComponent(logPane.getComponent());
}
// Display the errors pane?
if (GuiActions.getInstance().isErrorsWindowDisplayed()) {
bottomPane.setRightComponent(null);
}
// BottomPane = Log & Errors
if (needBottomPane()) {
mainPane.setBottomComponent(bottomPane);
}
}
/**
* Creates a new {@code BookBrowser} object.
*
* @param book the related book
*/
public BookBrowser (Book book)
{
this.book = book;
component = new JPanel();
// Set up the tree
model = new Model(book);
///model.addTreeModelListener(new ModelListener()); // Debug
/** The tree entity */
JTree tree = new JTree(model);
// Build left-side view
JScrollPane treeView = new JScrollPane(tree);
// Build right-side view
htmlPane = new JEditorPane("text/html", "");
htmlPane.setEditable(false);
JScrollPane htmlView = new JScrollPane(htmlPane);
// Allow only single selections
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
// Display lines to explicit relationships
tree.putClientProperty("JTree.lineStyle", "Angled");
// Wire the two views together. Use a selection listener
// created with an anonymous inner-class adapter.
// Listen for when the selection changes.
tree.addTreeSelectionListener(new SelectionListener());
// To be notified of expansion / collapse actions (debug ...)
///tree.addTreeExpansionListener(new ExpansionListener());
// Build split-pane view
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeView, htmlView);
splitPane.setName("treeHtmlSplitPane");
splitPane.setContinuousLayout(true);
splitPane.setBorder(null);
splitPane.setDividerSize(2);
// Add GUI components
component.setLayout(new BorderLayout());
component.add("Center", splitPane);
}
private void buildUI() {
LookAndFeelTweaks.setBorderLayout(this);
LookAndFeelTweaks.setBorder(this);
actionPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 2, 0));
actionPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
add("North", actionPanel);
sortButton = new JToggleButton(new ToggleSortingAction());
sortButton.setUI(new BlueishButtonUI());
sortButton.setText(null);
actionPanel.add(sortButton);
asCategoryButton = new JToggleButton(new ToggleModeAction());
asCategoryButton.setUI(new BlueishButtonUI());
asCategoryButton.setText(null);
actionPanel.add(asCategoryButton);
descriptionButton = new JToggleButton(new ToggleDescriptionAction());
descriptionButton.setUI(new BlueishButtonUI());
descriptionButton.setText(null);
actionPanel.add(descriptionButton);
split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
split.setBorder(null);
split.setResizeWeight(1.0);
split.setContinuousLayout(true);
add("Center", split);
tableScroll = new JScrollPane();
split.setTopComponent(tableScroll);
descriptionPanel = new JEditorPane("text/html", "<html>");
descriptionPanel.setBorder(BorderFactory.createEmptyBorder());
descriptionPanel.setEditable(false);
descriptionPanel.setBackground(UIManager.getColor("Panel.background"));
LookAndFeelTweaks.htmlize(descriptionPanel);
selectionListener = new SelectionListener();
descriptionScrollPane = new JScrollPane(descriptionPanel);
descriptionScrollPane.setBorder(LookAndFeelTweaks.addMargin(BorderFactory
.createLineBorder(UIManager.getColor("controlDkShadow"))));
descriptionScrollPane.getViewport().setBackground(
descriptionPanel.getBackground());
descriptionScrollPane.setMinimumSize(new Dimension(50, 50));
split.setBottomComponent(descriptionScrollPane);
// by default description is not visible, toolbar is visible.
setDescriptionVisible(false);
setToolBarVisible(true);
}
private JPanel initTopTermsPanel() {
JPanel panel = new JPanel(new GridLayout(1, 1));
panel.setOpaque(false);
JPanel selectedPanel = new JPanel(new BorderLayout());
selectedPanel.setOpaque(false);
JPanel innerPanel = new JPanel();
innerPanel.setOpaque(false);
innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.PAGE_AXIS));
innerPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
selectedPanel.add(innerPanel, BorderLayout.PAGE_START);
JPanel innerPanel1 = new JPanel(new FlowLayout(FlowLayout.LEADING));
innerPanel1.setOpaque(false);
innerPanel1.add(new JLabel(MessageUtils.getLocalizedMessage("overview.label.selected_field")));
innerPanel.add(innerPanel1);
selectedField.setColumns(20);
selectedField.setPreferredSize(new Dimension(100, 30));
selectedField.setFont(StyleConstants.FONT_MONOSPACE_LARGE);
selectedField.setEditable(false);
selectedField.setBackground(Color.white);
JPanel innerPanel2 = new JPanel(new FlowLayout(FlowLayout.LEADING));
innerPanel2.setOpaque(false);
innerPanel2.add(selectedField);
innerPanel.add(innerPanel2);
showTopTermsBtn.setText(MessageUtils.getLocalizedMessage("overview.button.show_terms"));
showTopTermsBtn.setPreferredSize(new Dimension(170, 40));
showTopTermsBtn.setFont(StyleConstants.FONT_BUTTON_LARGE);
showTopTermsBtn.addActionListener(listeners::showTopTerms);
showTopTermsBtn.setEnabled(false);
JPanel innerPanel3 = new JPanel(new FlowLayout(FlowLayout.LEADING));
innerPanel3.setOpaque(false);
innerPanel3.add(showTopTermsBtn);
innerPanel.add(innerPanel3);
JPanel innerPanel4 = new JPanel(new FlowLayout(FlowLayout.LEADING));
innerPanel4.setOpaque(false);
innerPanel4.add(new JLabel(MessageUtils.getLocalizedMessage("overview.label.num_top_terms")));
innerPanel.add(innerPanel4);
SpinnerNumberModel numberModel = new SpinnerNumberModel(50, 0, 1000, 1);
numTopTermsSpnr.setPreferredSize(new Dimension(80, 30));
numTopTermsSpnr.setModel(numberModel);
JPanel innerPanel5 = new JPanel(new FlowLayout(FlowLayout.LEADING));
innerPanel5.setOpaque(false);
innerPanel5.add(numTopTermsSpnr);
innerPanel.add(innerPanel5);
JPanel termsPanel = new JPanel(new BorderLayout());
termsPanel.setOpaque(false);
JLabel label = new JLabel(MessageUtils.getLocalizedMessage("overview.label.top_terms"));
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
termsPanel.add(label, BorderLayout.PAGE_START);
TableUtils.setupTable(topTermsTable, ListSelectionModel.SINGLE_SELECTION, new TopTermsTableModel(),
new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
listeners.showTopTermsContextMenu(e);
}
}, TopTermsTableModel.Column.RANK.getColumnWidth(), TopTermsTableModel.Column.FREQ.getColumnWidth());
JScrollPane scrollPane = new JScrollPane(topTermsTable);
termsPanel.add(scrollPane, BorderLayout.CENTER);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, selectedPanel, termsPanel);
splitPane.setOpaque(false);
splitPane.setDividerLocation(180);
splitPane.setBorder(BorderFactory.createEmptyBorder());
panel.add(splitPane);
return panel;
}
private void setupUI() {
Color borderColor = Colors.scale(UIManager.getColor("Panel.background"), .8f);
setTitle(TITLE);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new EditorWindowListener());
setIconImages(Lists.newArrayList("512","256","128","64","48","32","24","20","16").stream()
.map(size -> Images.loadFromClasspath("images/icon-" + size + ".png").getImage())
.collect(Collectors.toList()));
translationTree = new TranslationTree();
translationTree.setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
translationTree.addTreeSelectionListener(new TranslationTreeNodeSelectionListener());
translationTree.addMouseListener(new TranslationTreeMouseListener());
translationField = new TranslationKeyField();
translationField.addKeyListener(new TranslationFieldKeyListener());
translationField.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(1,0,0,1,borderColor),
((CompoundBorder)translationField.getBorder()).getInsideBorder()));
JScrollPane translationsScrollPane = new JScrollPane(translationTree);
translationsScrollPane.getViewport().setOpaque(false);
translationsScrollPane.setOpaque(false);
translationsScrollPane.setBorder(BorderFactory.createMatteBorder(0,0,0,1,borderColor));
translationsPanel = new JPanel(new BorderLayout());
translationsPanel.add(translationsScrollPane);
translationsPanel.add(translationField, BorderLayout.SOUTH);
resourcesPanel = new JScrollablePanel(true, false);
resourcesPanel.setLayout(new BoxLayout(resourcesPanel, BoxLayout.Y_AXIS));
resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
resourcesPanel.setOpaque(false);
resourcesPanel.addMouseListener(new ResourcesPaneMouseListener());
resourcesScrollPane = new JScrollPane(resourcesPanel);
resourcesScrollPane.getViewport().setOpaque(false);
resourcesScrollPane.setOpaque(false);
resourcesScrollPane.setBorder(null);
resourcesScrollPane.addMouseListener(new ResourcesPaneMouseListener());
contentPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, translationsPanel, resourcesScrollPane);
contentPane.setBorder(null);
contentPane.setDividerSize(10);
// Style the split pane divider if possible
SplitPaneUI splitPaneUI = contentPane.getUI();
if (splitPaneUI instanceof BasicSplitPaneUI) {
BasicSplitPaneDivider divider = ((BasicSplitPaneUI)splitPaneUI).getDivider();
divider.setBorder(null);
resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,20));
}
introText = new JLabel("<html><body style=\"text-align:center; padding:30px;\">" +
MessageBundle.get("core.intro.text") + "</body></html>");
introText.setOpaque(true);
introText.setFont(introText.getFont().deriveFont(28f));
introText.setHorizontalTextPosition(JLabel.CENTER);
introText.setVerticalTextPosition(JLabel.BOTTOM);
introText.setHorizontalAlignment(JLabel.CENTER);
introText.setVerticalAlignment(JLabel.CENTER);
introText.setForeground(getBackground().darker());
introText.setIcon(Images.loadFromClasspath("images/icon-intro.png"));
Container container = getContentPane();
container.add(introText);
editorMenu = new EditorMenuBar(this, translationTree);
setJMenuBar(editorMenu);
}