List of usage examples for javax.swing JSplitPane HORIZONTAL_SPLIT
int HORIZONTAL_SPLIT
To view the source code for javax.swing JSplitPane HORIZONTAL_SPLIT.
Click Source Link
Component
s are split along the x axis. From source file:com.diversityarrays.kdxplore.trials.TrialSelectionDialog.java
@SuppressWarnings("rawtypes") @Override// w w w . jav a2 s . co m protected Component createMainPanel() { CheckSelectionButtonsPanel csbp = new CheckSelectionButtonsPanel(CheckSelectionButtonsPanel.ALL, trialRecordTable); csbp.addUncheckAllActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trialRecordTableModel.clearChosen(); } }); csbp.addCheckAllActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trialRecordTableModel.chooseAll(); } }); csbp.addCheckSelectedActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { List<Integer> selectedModelRows = GuiUtil.getSelectedModelRows(trialRecordTable); trialRecordTableModel.addChosenRows(selectedModelRows); } }); csbp.addCheckUnselectedActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Set<Integer> selectedModelRows = new HashSet<>(GuiUtil.getSelectedModelRows(trialRecordTable)); if (selectedModelRows.isEmpty()) { trialRecordTableModel.chooseAll(); } else { List<Integer> rowsToChoose = new ArrayList<>(); for (int mrow = trialRecordTable.getRowCount(); --mrow >= 0;) { if (!selectedModelRows.contains(mrow)) { rowsToChoose.add(mrow); } } trialRecordTableModel.addChosenRows(rowsToChoose); } } }); Box buttons = Box.createHorizontalBox(); buttons.add(Box.createHorizontalGlue()); buttons.add(new JLabel("Select one or more and click '" + USE_TRIALS + "'")); buttons.add(csbp); buttons.add(Box.createHorizontalGlue()); List<TableColumn> columns = DartEntityTableModel.collectNamedColumns(trialRecordTable, trialRecordTableModel, true, "TrialName", "Site", "# Plots", "# Measurements", "Design", "Manager", "TrialType", "Project", "Start Date"); // List<TableColumn> columns = DartEntityTableModel.collectNonExpertColumns(trialRecordTable, trialRecordTableModel, true); Map<String, TableColumn[]> choices = new HashMap<>(); choices.put(INITIAL_COLUMNS_TAGNAME, columns.toArray(new TableColumn[columns.size()])); TableColumnSelectionButton tcsb = new TableColumnSelectionButton(trialRecordTable, choices); tcsb.setSelectedColumns(INITIAL_COLUMNS_TAGNAME); trialRecordTable.setRowSorter(new TableRowSorter<DartEntityTableModel>(trialRecordTableModel)); JScrollPane scrollPane = new JScrollPane(trialRecordTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, tcsb); JPanel trialsPanel = new JPanel(new BorderLayout()); trialsPanel.add(messageLabel, BorderLayout.NORTH); trialsPanel.add(scrollPane, BorderLayout.CENTER); trialsPanel.add(buttons, BorderLayout.SOUTH); cardPanel.add(helpInstructions, CARD_HELP); cardPanel.add(trialsPanel, CARD_TRIALS); cardLayout.show(cardPanel, CARD_HELP); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, searchOptionsPanel.getViewComponent(), cardPanel); return splitPane; }
From source file:com.mirth.connect.client.ui.editors.filter.FilterPane.java
/** * This method is called from within the constructor to initialize the form. *//* w w w . jav a2 s.c om*/ public void initComponents() { // the available panels (cards) rulePanel = new BasePanel(); blankPanel = new BasePanel(); scriptTextArea = new MirthRTextScrollPane(null, true, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, false); scriptTextArea.setBackground(new Color(204, 204, 204)); scriptTextArea.setBorder(BorderFactory.createEtchedBorder()); scriptTextArea.getTextArea().setEditable(false); scriptTextArea.getTextArea().setDropTarget(null); generatedScriptPanel = new JPanel(); generatedScriptPanel.setBackground(Color.white); generatedScriptPanel.setLayout(new CardLayout()); generatedScriptPanel.add(scriptTextArea, ""); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Rule", rulePanel); tabbedPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { switchTab = (lastSelectedIndex == 0 && tabbedPane.getSelectedIndex() == 1) ? true : false; updateCodePanel(null); } }); for (FilterRulePlugin filterRulePlugin : LoadedExtensions.getInstance().getFilterRulePlugins().values()) { filterRulePlugin.initialize(this); } // establish the cards to use in the Transformer rulePanel.addCard(blankPanel, BLANK_TYPE); for (FilterRulePlugin plugin : LoadedExtensions.getInstance().getFilterRulePlugins().values()) { rulePanel.addCard(plugin.getPanel(), plugin.getPluginPointName()); } filterTablePane = new JScrollPane(); viewTasks = new JXTaskPane(); viewTasks.setTitle("Mirth Views"); viewTasks.setFocusable(false); filterPopupMenu = new JPopupMenu(); viewTasks.add(initActionCallback("accept", "Return back to channel.", ActionFactory.createBoundAction("accept", "Back to Channel", "B"), new ImageIcon(Frame.class.getResource("images/resultset_previous.png")))); parent.setNonFocusable(viewTasks); viewTasks.setVisible(false); parent.taskPaneContainer.add(viewTasks, parent.taskPaneContainer.getComponentCount() - 1); filterTasks = new JXTaskPane(); filterTasks.setTitle("Filter Tasks"); filterTasks.setFocusable(false); // add new rule task filterTasks.add(initActionCallback("addNewRule", "Add a new filter rule.", ActionFactory.createBoundAction("addNewRule", "Add New Rule", "N"), new ImageIcon(Frame.class.getResource("images/add.png")))); JMenuItem addNewRule = new JMenuItem("Add New Rule"); addNewRule.setIcon(new ImageIcon(Frame.class.getResource("images/add.png"))); addNewRule.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addNewRule(); } }); filterPopupMenu.add(addNewRule); // delete rule task filterTasks.add(initActionCallback("deleteRule", "Delete the currently selected filter rule.", ActionFactory.createBoundAction("deleteRule", "Delete Rule", "X"), new ImageIcon(Frame.class.getResource("images/delete.png")))); JMenuItem deleteRule = new JMenuItem("Delete Rule"); deleteRule.setIcon(new ImageIcon(Frame.class.getResource("images/delete.png"))); deleteRule.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { deleteRule(); } }); filterPopupMenu.add(deleteRule); filterTasks.add(initActionCallback("doImport", "Import a filter from an XML file.", ActionFactory.createBoundAction("doImport", "Import Filter", "I"), new ImageIcon(Frame.class.getResource("images/report_go.png")))); JMenuItem importFilter = new JMenuItem("Import Filter"); importFilter.setIcon(new ImageIcon(Frame.class.getResource("images/report_go.png"))); importFilter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doImport(); } }); filterPopupMenu.add(importFilter); filterTasks.add(initActionCallback("doExport", "Export the filter to an XML file.", ActionFactory.createBoundAction("doExport", "Export Filter", "E"), new ImageIcon(Frame.class.getResource("images/report_disk.png")))); JMenuItem exportFilter = new JMenuItem("Export Filter"); exportFilter.setIcon(new ImageIcon(Frame.class.getResource("images/report_disk.png"))); exportFilter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doExport(); } }); filterPopupMenu.add(exportFilter); filterTasks.add(initActionCallback("doValidate", "Validate the currently viewed script.", ActionFactory.createBoundAction("doValidate", "Validate Script", "V"), new ImageIcon(Frame.class.getResource("images/accept.png")))); JMenuItem validateStep = new JMenuItem("Validate Script"); validateStep.setIcon(new ImageIcon(Frame.class.getResource("images/accept.png"))); validateStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doValidate(); } }); filterPopupMenu.add(validateStep); // move rule up task filterTasks.add(initActionCallback("moveRuleUp", "Move the currently selected rule up.", ActionFactory.createBoundAction("moveRuleUp", "Move Rule Up", "P"), new ImageIcon(Frame.class.getResource("images/arrow_up.png")))); JMenuItem moveRuleUp = new JMenuItem("Move Rule Up"); moveRuleUp.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_up.png"))); moveRuleUp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { moveRuleUp(); } }); filterPopupMenu.add(moveRuleUp); // move rule down task filterTasks.add(initActionCallback("moveRuleDown", "Move the currently selected rule down.", ActionFactory.createBoundAction("moveRuleDown", "Move Rule Down", "D"), new ImageIcon(Frame.class.getResource("images/arrow_down.png")))); JMenuItem moveRuleDown = new JMenuItem("Move Rule Down"); moveRuleDown.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_down.png"))); moveRuleDown.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { moveRuleDown(); } }); filterPopupMenu.add(moveRuleDown); // add the tasks to the taskpane, and the taskpane to the mirth client parent.setNonFocusable(filterTasks); filterTasks.setVisible(false); parent.taskPaneContainer.add(filterTasks, parent.taskPaneContainer.getComponentCount() - 1); makeFilterTable(); // BGN LAYOUT filterTablePane.setBorder(BorderFactory.createEmptyBorder()); rulePanel.setBorder(BorderFactory.createEmptyBorder()); hSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, filterTablePane, tabbedPane); hSplitPane.setContinuousLayout(true); hSplitPane.setOneTouchExpandable(true); vSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, hSplitPane, refPanel); vSplitPane.setContinuousLayout(true); vSplitPane.setOneTouchExpandable(true); this.setLayout(new BorderLayout()); this.add(vSplitPane, BorderLayout.CENTER); this.setBorder(BorderFactory.createEmptyBorder()); vSplitPane.setBorder(BorderFactory.createEmptyBorder()); hSplitPane.setBorder(BorderFactory.createEmptyBorder()); resizePanes(); // END LAYOUT }
From source file:jmemorize.gui.swing.frames.MainFrame.java
private void initComponents() { final JPanel mainPanel = new JPanel(new BorderLayout()); m_deckChartPanel = new DeckChartPanel(this); m_deckChartPanel.setMinimumSize(new Dimension(100, 150)); m_learnPanel = new LearnPanel(); m_deckTablePanel = new DeckTablePanel(this); // north panel final JPanel northPanel = new JPanel(); northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS)); northPanel.add(buildOperationsBar()); northPanel.add(buildCategoryBar());//from w w w.j av a 2 s . c o m m_categoryTree = new CategoryTree(jMemorizeIO); m_categoryTree.addSelectionObserver(new SelectionObserver() { @Override public void selectionChanged(final SelectionProvider source) { treeSelectionChanged(source); } }); m_treeScrollPane = new JScrollPane(m_categoryTree); // bottom panel m_bottomPanel = new JPanel(new CardLayout()); m_bottomPanel.add(m_deckTablePanel, DECK_CARD); m_bottomPanel.add(m_learnPanel, REPEAT_CARD); // vertical split pane m_verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); m_verticalSplitPane.setPreferredSize(new Dimension(16, 500)); m_verticalSplitPane.setBorder(null); beautifyDividerBorder(m_verticalSplitPane); m_verticalSplitPane.setTopComponent(m_deckChartPanel); m_verticalSplitPane.setBottomComponent(m_bottomPanel); mainPanel.setPreferredSize(new Dimension(800, 500)); mainPanel.add(m_verticalSplitPane, BorderLayout.CENTER); // horizontal split pane m_horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); m_horizontalSplitPane.setDividerLocation(m_categoryTreeWidth); m_horizontalSplitPane.setDividerSize(DIVIDER_SIZE); m_horizontalSplitPane.setBorder(null); m_horizontalSplitPane.setLeftComponent(m_treeScrollPane); m_horizontalSplitPane.setRightComponent(mainPanel); // frame content pane getContentPane().add(northPanel, BorderLayout.NORTH); getContentPane().add(m_horizontalSplitPane, BorderLayout.CENTER); getContentPane().add(m_statusBar, BorderLayout.SOUTH); setJMenuBar(new MainMenu(this, m_main.getRecentLessonFiles(), jMemorizeIO, this)); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent evt) { ExitAction.exit(); } }); setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/resource/icons/main.png"))); //$NON-NLS-1$ pack(); }
From source file:com.zigabyte.stock.stratplot.StrategyPlotter.java
private void initLayout() { Container content = this.getContentPane(); JComponent controls = Box.createVerticalBox(); {/*from w ww. j a v a 2 s. c om*/ JPanel filePanel = new JPanel(new BorderLayout()); { filePanel.setBorder(BorderFactory.createTitledBorder("Stock Market Trading Data")); JPanel dataButtons = new JPanel(new GridLayout(2, 1)); { dataButtons.add(this.loadFileButton); dataButtons.add(this.viewDataButton); } filePanel.add(dataButtons, BorderLayout.EAST); JPanel fileControls = new JPanel(new FlowLayout()); { fileControls.add(new JLabel("Stock data File:")); fileControls.add(this.fileField); fileControls.add(this.fileBrowseButton); fileControls.add(new JLabel(" Stock data format:")); fileControls.add(this.fileFormatCombo); } filePanel.add(fileControls, BorderLayout.CENTER); } controls.add(filePanel); JComponent simPanel = new JPanel(new BorderLayout()); { simPanel.setBorder(BorderFactory.createTitledBorder("Simulation Run")); simPanel.add(this.runButton, BorderLayout.EAST); JComponent simControlsPanel = Box.createVerticalBox(); { JPanel accountControls = new JPanel(new FlowLayout()); { accountControls.add(new JLabel("Initial Cash:")); accountControls.add(this.initialCashField); accountControls.add(new JLabel(" Per Trade Fee:")); accountControls.add(this.perTradeFeeField); accountControls.add(new JLabel(" Per Share Trade Commission:")); accountControls.add(this.perShareTradeCommissionField); accountControls.add(new JLabel(" Compare:")); accountControls.add(this.compareIndexSymbolField); } simControlsPanel.add(accountControls); JPanel runControls = new JPanel(new FlowLayout()); { runControls.add(this.strategyField); runControls.add(new JLabel("Start Date:")); runControls.add(this.startDateField); runControls.add(new JLabel(" End Date:")); runControls.add(this.endDateField); runControls.add(new JLabel(" Strategy:")); runControls.add(this.strategyField); runControls.add(this.editButton); runControls.add(this.compileButton); } simControlsPanel.add(runControls); } simPanel.add(simControlsPanel, BorderLayout.CENTER); } controls.add(simPanel); } content.add(controls, BorderLayout.NORTH); JSplitPane vSplit = this.vSplit; { vSplit.setResizeWeight(0.5); vSplit.add(this.chartPanel, JSplitPane.TOP); JSplitPane hSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); { hSplit.setResizeWeight(0.5); // enough for no hscrollbar in 1024 width JSplitPane reportSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); { reportSplit.setResizeWeight(0.5); JScrollPane reportScroll = new JScrollPane(this.reportArea); { reportScroll.setBorder(BorderFactory.createTitledBorder("Report")); } reportSplit.add(reportScroll, JSplitPane.TOP); JScrollPane monthScroll = new JScrollPane(this.monthlyLogArea); { monthScroll.setBorder(BorderFactory.createTitledBorder("Monthly Log")); } reportSplit.add(monthScroll, JSplitPane.BOTTOM); } hSplit.add(reportSplit, JSplitPane.LEFT); JScrollPane tradeScroll = new JScrollPane(this.tradeLogArea); { tradeScroll.setBorder(BorderFactory.createTitledBorder("Trade Log")); } hSplit.add(tradeScroll, JSplitPane.RIGHT); } vSplit.add(hSplit, JSplitPane.BOTTOM); } content.add(vSplit, BorderLayout.CENTER); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java
/** * Inicia os componentes//w ww . j a v a 2 s.c om * * @param erros */ private void initComponentsEscalavel(ArrayList<FerramentaAnaliseGeralModel> erros) { incValueProgress(); hashCodeInicial = null; PainelStatusBar.hideProgTarReq(); Ferramenta_Imagens.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); PainelStatusBar.setValueProgress(3); boxCode = new G_TextAreaSourceCode(); boxCode.setTipoHTML(); incValueProgress(); parentFrame.setJMenuBar(this.criaMenuBar()); PainelStatusBar.setValueProgress(6); // parentFrame.setTitle("Associador de rtulos"); tableLinCod = new TabelaAnaliseGeral(this, erros); arTextPainelCorrecao = new ArTextPainelCorrecao(this); incValueProgress(); // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel(); analiseSistematica = new JButton(); salvar = new JButton(); cancelar = new JButton(); salvarMod = new JButton(); salvarPag = new JButton(); aplicarPag = new JButton(); aplicarTod = new JButton(); strConteudoalt = new String(); incValueProgress(); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); PainelStatusBar.setValueProgress(10); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); spTextoDescricao = new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(this); conteudoDoAlt = new JTextArea(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); incValueProgress(); /** * Mostra pro usurio a imagem que est sem descrio */ imagemSemDesc = new XHTMLPanel(); pnBotoes = new JPanel(); salvar.setEnabled(false); // salvaAlteracoes = new SalvaAlteracoes(boxCode.getTextPane(), salvar, // btnSalvar, parentFrame); adicionar = new JButton(); aplicar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); analiseSistematica.setEnabled(false); boxCode.getTextPane().setText(TxtBuffer.getContent()); PainelStatusBar.setValueProgress(20); String fullUrl = this.enderecoImagem; System.out.println("\t\t\t\t\tendereo da imagem: " + fullUrl); SetImage setImage = new SetImage(this, fullUrl); setImage.start(); incValueProgress(); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); incValueProgress(); // ======== pnRegra ======== { pnRegra.setBorder(criaBorda(Ferramenta_Imagens.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(Ferramenta_Imagens.REGRAP1); lbRegras2.setText(Ferramenta_Imagens.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); incValueProgress(); } PainelStatusBar.setValueProgress(30); // G_URLIcon.setIcon(lbTemp, // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg"); JScrollPane sp = new JScrollPane(); sp.setViewportView(imagemSemDesc); sp.setPreferredSize(new Dimension(500, 300)); // ======== pnDescricao ======== incValueProgress(); // ---- Salvar ---- salvarMod.setText(GERAL.SALVAR_MODIFICADAS); salvarMod.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarModificadosActionPerformed(e); } }); incValueProgress(); salvarMod.setToolTipText(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.getAccessibleContext().setAccessibleName(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.setBounds(10, 0, 150, 25); PainelStatusBar.setValueProgress(40); salvarPag.setText(GERAL.SALVAR_ULTIMA); salvarPag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarPaginaActionPerformed(e); } }); incValueProgress(); salvarPag.setToolTipText(GERAL.DICA_SALVAR_ULTIMA_MODIFICADA); salvarPag.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_ULTIMA_MODIFICADA); salvarPag.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ABRIR_HTML); salvarPag.setBounds(165, 0, 150, 25); incValueProgress(); salvarMod.setEnabled(false); salvarPag.setEnabled(false); ArrayList<JButton> btnsSalvar = new ArrayList<JButton>(); btnsSalvar.add(salvarMod); btnsSalvar.add(salvarPag); btnsSalvar.add(salvar); salvaAlteracoes = new SalvaAlteracoes(boxCode.getTextPane(), btnsSalvar, btnSalvar, parentFrame); aplicarPag.setText(GERAL.APLICAR_PAGINA); aplicarPag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarPaginaActionPerformed(e); } }); incValueProgress(); PainelStatusBar.setValueProgress(50); aplicarPag.setToolTipText(GERAL.DICA_APLICA_PAGINA); aplicarPag.getAccessibleContext().setAccessibleDescription(GERAL.DICA_APLICA_PAGINA); aplicarPag.getAccessibleContext().setAccessibleName(GERAL.DICA_APLICA_PAGINA); aplicarPag.setBounds(320, 0, 150, 25); incValueProgress(); aplicarTod.setText(GERAL.APLICA_TODOS); aplicarTod.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread t = new Thread(new Runnable() { public void run() { aplicarATodosActionPerformed(); } }); t.start(); } }); incValueProgress(); aplicarTod.setToolTipText(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.getAccessibleContext().setAccessibleDescription(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.getAccessibleContext().setAccessibleName(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.setBounds(475, 0, 150, 25); aplicarPag.setEnabled(false); aplicarTod.setEnabled(false); PainelStatusBar.setValueProgress(60); incValueProgress(); cancelar.setText(GERAL.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.setBounds(630, 0, 150, 25); incValueProgress(); pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT)); GridBagConstraints cons = new GridBagConstraints(); GridBagLayout layout = new GridBagLayout(); cons.fill = GridBagConstraints.BOTH; cons.weighty = 1; cons.weightx = 0.80; PainelStatusBar.setValueProgress(70); incValueProgress(); pnSetaDescricao.setLayout(layout); cons.anchor = GridBagConstraints.SOUTHEAST; cons.insets = new Insets(0, 0, 0, 10); // ======== spParticRotulo ======== conteudoDoAlt.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent arg0) { } public void keyTyped(KeyEvent arg0) { } public void keyReleased(KeyEvent arg0) { if (conteudoDoAlt.getText().length() == 0 || tableLinCod.getNumLinhas() < 1) { System.out.println("conteudo vazio"); aplicarPag.setEnabled(false); aplicarTod.setEnabled(false); } else if (tableLinCod.getSelectedRow() != -1) { System.out.println("com conteudo"); aplicarPag.setEnabled(true); aplicarTod.setEnabled(true); } else { aplicarTod.setEnabled(true); } } }); { spTextoDescricao.setViewportView(conteudoDoAlt); } incValueProgress(); // lbRegras1.setText(Reparo_Imagens.REGRAP2); // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); // pnRegra.add(lbRegras1); pnSetaDescricao.add(spTextoDescricao, cons); cons.weightx = 0.20; pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); // ======== pnListaErros ======== { PainelStatusBar.setValueProgress(80); pnListaErros.setBorder(criaBorda(Ferramenta_Imagens.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tableLinCod); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== incValueProgress(); { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- adicionar.setText(Ferramenta_Imagens.BTN_ADICIONAR); adicionar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { adicionarActionPerformed(e); } }); PainelStatusBar.setValueProgress(90); adicionar.setToolTipText(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.setBounds(10, 5, 150, 25); // pnBotoes.add(adicionar); incValueProgress(); // ---- aplicarRotulo ---- aplicar.setEnabled(false); aplicar.setText(Ferramenta_Imagens.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); incValueProgress(); aplicar.setToolTipText(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_APLICAR); aplicar.setBounds(10, 5, 150, 25); // pnBotoes.add(aplicar); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); boxCode.setBorder(criaBorda("")); boxCode.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); // JScrollPane ajudaScrollPane = new // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); PainelStatusBar.setValueProgress(93); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, boxCode); splitPane.setOneTouchExpandable(true); // splitPane.set // splitPane.setDividerLocation(0.95); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); incValueProgress(); // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER); regraFonteBtn.add(splitPane, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); PainelStatusBar.setValueProgress(96); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnSetaDescricao.setBackground(CoresDefault.getCorPaineis()); pnSetaDescricao.add(pnBotoes, cons); textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); incValueProgress(); pnSalvarCancelar.add(salvarMod); pnSalvarCancelar.add(salvarPag); pnSalvarCancelar.add(aplicarPag); pnSalvarCancelar.add(aplicarTod); pnSalvarCancelar.add(cancelar); pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); PainelStatusBar.setValueProgress(100); pnListaErros.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); contentPane.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); contentPane.add(textoErrosBtn); System.out.println("\t\t\t" + TxtBuffer.getContent()); incValueProgress(); this.setVisible(true); }
From source file:com.mirth.connect.client.ui.editors.transformer.TransformerPane.java
/** * This method is called from within the constructor to initialize the form. *//*w w w . ja v a2 s . co m*/ public void initComponents() { // the available panels (cards) stepPanel = new BasePanel(); blankPanel = new BasePanel(); scriptTextArea = new MirthRTextScrollPane(null, true, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, false); scriptTextArea.setBackground(new Color(204, 204, 204)); scriptTextArea.setBorder(BorderFactory.createEtchedBorder()); scriptTextArea.getTextArea().setEditable(false); scriptTextArea.getTextArea().setDropTarget(null); generatedScriptPanel = new JPanel(); generatedScriptPanel.setBackground(Color.white); generatedScriptPanel.setLayout(new CardLayout()); generatedScriptPanel.add(scriptTextArea, ""); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Step", stepPanel); tabbedPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { switchTab = (lastSelectedIndex == 0 && tabbedPane.getSelectedIndex() == 1) ? true : false; updateCodePanel(null); } }); for (TransformerStepPlugin transformerStepPlugin : LoadedExtensions.getInstance() .getTransformerStepPlugins().values()) { transformerStepPlugin.initialize(this); } // establish the cards to use in the Transformer stepPanel.addCard(blankPanel, BLANK_TYPE); for (TransformerStepPlugin plugin : LoadedExtensions.getInstance().getTransformerStepPlugins().values()) { stepPanel.addCard(plugin.getPanel(), plugin.getPluginPointName()); } transformerTablePane = new JScrollPane(); transformerTablePane.setBorder(BorderFactory.createEmptyBorder()); viewTasks = new JXTaskPane(); viewTasks.setTitle("Mirth Views"); viewTasks.setFocusable(false); viewTasks.add(initActionCallback("accept", "Return back to channel.", ActionFactory.createBoundAction("accept", "Back to Channel", "B"), new ImageIcon(Frame.class.getResource("images/resultset_previous.png")))); parent.setNonFocusable(viewTasks); viewTasks.setVisible(false); parent.taskPaneContainer.add(viewTasks, parent.taskPaneContainer.getComponentCount() - 1); transformerTasks = new JXTaskPane(); transformerTasks.setTitle("Transformer Tasks"); transformerTasks.setFocusable(false); transformerPopupMenu = new JPopupMenu(); // add new step task transformerTasks.add(initActionCallback("addNewStep", "Add a new transformer step.", ActionFactory.createBoundAction("addNewStep", "Add New Step", "N"), new ImageIcon(Frame.class.getResource("images/add.png")))); JMenuItem addNewStep = new JMenuItem("Add New Step"); addNewStep.setIcon(new ImageIcon(Frame.class.getResource("images/add.png"))); addNewStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addNewStep(); } }); transformerPopupMenu.add(addNewStep); // delete step task transformerTasks.add(initActionCallback("deleteStep", "Delete the currently selected transformer step.", ActionFactory.createBoundAction("deleteStep", "Delete Step", "X"), new ImageIcon(Frame.class.getResource("images/delete.png")))); JMenuItem deleteStep = new JMenuItem("Delete Step"); deleteStep.setIcon(new ImageIcon(Frame.class.getResource("images/delete.png"))); deleteStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { deleteStep(); } }); transformerPopupMenu.add(deleteStep); transformerTasks.add(initActionCallback("doImport", "Import a transformer from an XML file.", ActionFactory.createBoundAction("doImport", "Import Transformer", "I"), new ImageIcon(Frame.class.getResource("images/report_go.png")))); JMenuItem importTransformer = new JMenuItem("Import Transformer"); importTransformer.setIcon(new ImageIcon(Frame.class.getResource("images/report_go.png"))); importTransformer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doImport(); } }); transformerPopupMenu.add(importTransformer); transformerTasks.add(initActionCallback("doExport", "Export the transformer to an XML file.", ActionFactory.createBoundAction("doExport", "Export Transformer", "E"), new ImageIcon(Frame.class.getResource("images/report_disk.png")))); JMenuItem exportTransformer = new JMenuItem("Export Transformer"); exportTransformer.setIcon(new ImageIcon(Frame.class.getResource("images/report_disk.png"))); exportTransformer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doExport(); } }); transformerPopupMenu.add(exportTransformer); transformerTasks.add(initActionCallback("doValidate", "Validate the currently viewed script.", ActionFactory.createBoundAction("doValidate", "Validate Script", "V"), new ImageIcon(Frame.class.getResource("images/accept.png")))); JMenuItem validateStep = new JMenuItem("Validate Script"); validateStep.setIcon(new ImageIcon(Frame.class.getResource("images/accept.png"))); validateStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doValidate(); } }); transformerPopupMenu.add(validateStep); // move step up task transformerTasks.add(initActionCallback("moveStepUp", "Move the currently selected step up.", ActionFactory.createBoundAction("moveStepUp", "Move Step Up", "P"), new ImageIcon(Frame.class.getResource("images/arrow_up.png")))); JMenuItem moveStepUp = new JMenuItem("Move Step Up"); moveStepUp.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_up.png"))); moveStepUp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { moveStepUp(); } }); transformerPopupMenu.add(moveStepUp); // move step down task transformerTasks.add(initActionCallback("moveStepDown", "Move the currently selected step down.", ActionFactory.createBoundAction("moveStepDown", "Move Step Down", "D"), new ImageIcon(Frame.class.getResource("images/arrow_down.png")))); JMenuItem moveStepDown = new JMenuItem("Move Step Down"); moveStepDown.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_down.png"))); moveStepDown.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { moveStepDown(); } }); transformerPopupMenu.add(moveStepDown); // add the tasks to the taskpane, and the taskpane to the mirth client parent.setNonFocusable(transformerTasks); transformerTasks.setVisible(false); parent.taskPaneContainer.add(transformerTasks, parent.taskPaneContainer.getComponentCount() - 1); makeTransformerTable(); // BGN LAYOUT transformerTable.setBorder(BorderFactory.createEmptyBorder()); transformerTablePane.setBorder(BorderFactory.createEmptyBorder()); transformerTablePane.setMinimumSize(new Dimension(0, 40)); stepPanel.setBorder(BorderFactory.createEmptyBorder()); hSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, transformerTablePane, tabbedPane); hSplitPane.setContinuousLayout(true); // hSplitPane.setDividerSize(6); hSplitPane.setOneTouchExpandable(true); vSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, hSplitPane, refPanel); // vSplitPane.setDividerSize(6); vSplitPane.setOneTouchExpandable(true); vSplitPane.setContinuousLayout(true); hSplitPane.setBorder(BorderFactory.createEmptyBorder()); vSplitPane.setBorder(BorderFactory.createEmptyBorder()); this.setLayout(new BorderLayout()); this.add(vSplitPane, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder()); resizePanes(); // END LAYOUT }
From source file:edu.ucla.stat.SOCR.applications.demo.StockApplication.java
void updateGraph() { //System.out.println("UpdateGraph get called") // System.out.println("S0="+S0+" E="+E+" P="+P); calculate(choice);//from w ww .j ava 2 s .co m XYSeriesCollection ds = createDataset(choice); JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title xAxis, // x axis label yAxis, // y axis label ds, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); XYPlot subplot1 = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) subplot1.getRenderer(); renderer1.setSeriesPaint(0, Color.red); renderer1.setSeriesPaint(1, Color.blue); renderer1.setSeriesPaint(2, Color.green); renderer1.setSeriesPaint(3, Color.gray); /* Shape shape = renderer1.getBaseShape(); renderer1.setSeriesShape(2, shape); renderer1.setSeriesShape(3, shape);*/ renderer1.setBaseLinesVisible(true); renderer1.setBaseShapesVisible(true); renderer1.setBaseShapesFilled(true); chartPanel = new ChartPanel(chart, false); chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y)); upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel), new JScrollPane(chartPanel)); this.getMainPanel().removeAll(); this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER); this.getMainPanel().validate(); // getRecordTable().setText("Any Explaination goes here."); // }
From source file:net.sf.nmedit.nomad.core.Nomad.java
void setupUI() { this.clipBoard = new Clipboard("nomad clipboard"); ApplicationClipboard.setApplicationClipboard(clipBoard); mainWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Nomad.sharedInstance().handleExit(); }/*from w ww .ja v a2 s. com*/ }); pageContainer = new DefaultDocumentManager(); Container contentPane = mainWindow.getContentPane(); explorerTree = new FileExplorerTree(); explorerTree.setFont(new Font("Arial", Font.PLAIN, 11)); explorerTree.createPopup(menuBuilder); JScrollPane explorerTreeScroller = new JScrollPane(explorerTree); toolPane = new JTabbedPane2(); toolPane.setCloseActionEnabled(false); toolPane.addTab("Explorer", getImage("/icons/eview16/filenav_nav.gif"), explorerTreeScroller); new DropTarget(contentPane, new URIListDropHandler() { public void uriListDropped(URI[] uriList) { for (URI uri : uriList) { try { File f = new File(uri); openOrSelect(f); } catch (IllegalArgumentException e) { // ignore } } } }); synthPane = new JTabbedPane2(); synthPane.setCloseActionEnabled(true); JSplitPane sidebarSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false); sidebarSplit.setTopComponent(toolPane); sidebarSplit.setBottomComponent(synthPane); sidebarSplit.setResizeWeight(0.8); sidebarSplit.setOneTouchExpandable(true); /* JComponent sidebar = new JPanel(new BorderLayout()); sidebar.setBorder(null); sidebar.add(sidebarSplit, BorderLayout.CENTER); */ if (!Platform.isFlavor(OS.MacOSFlavor)) { /* JToolBar tb = createQuickActionToolbar(); sidebar.add(tb, BorderLayout.NORTH);*/ } else { registerForMacOSXEvents(); } JSplitPane splitLR = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitLR.setResizeWeight(0); splitLR.setDividerLocation(200); splitLR.setRightComponent(pageContainer); splitLR.setLeftComponent(sidebarSplit); contentPane.setLayout(new BorderLayout()); contentPane.add(splitLR, BorderLayout.CENTER); if (contentPane instanceof JComponent) ((JComponent) contentPane).revalidate(); }
From source file:com.nikonhacker.gui.EmulatorUI.java
public EmulatorUI() { super(ApplicationInfo.getNameVersion() + " - (none) / (none)"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); prefs = Prefs.load();//from w w w . j a va2 s.c o m // Apply register label prefs immediately FrCPUState.initRegisterLabels(prefs.getOutputOptions(Constants.CHIP_FR)); TxCPUState.initRegisterLabels(prefs.getOutputOptions(Constants.CHIP_TX)); // Create and set up the Emulation Framework framework = new EmulationFramework(prefs); //Set up the GUI. setJMenuBar(createMenuBar()); toolbarButtonMargin = new Insets(2, 14, 2, 14); JPanel[] contentPane = new JPanel[2]; for (int chip = 0; chip < 2; chip++) { // This is the contentPane that will make one side of the JSplitPane contentPane[chip] = new JPanel(new BorderLayout()); // First we create a toolbar and put it on top toolBar[chip] = createToolBar(chip); contentPane[chip].add(toolBar[chip], BorderLayout.NORTH); // Then we prepare a "desktop" panel and put it at the center // This subclass of JDesktopPane implements Scrollable and has a size which auto-adapts dynamically // to the size and position of its internal frames mdiPane[chip] = new ScrollableDesktop(); mdiPane[chip].setBackground(Constants.CHIP_BACKGROUND_COLOR[chip]); mdiPane[chip].setOpaque(true); // We wrap it inside a panel to force a stretch to the size of the JSplitPane panel // Otherwise, as the size of the panel auto-adapts, it starts at 0,0 if no component is present, // so the background color would only be only visible in the bounding box surrounding the internal frames JPanel forcedStretchPanel = new JPanel(new BorderLayout()); forcedStretchPanel.add(mdiPane[chip], BorderLayout.CENTER); // And we wrap the result in a JScrollPane to take care of the actual scrolling, // before adding it at the center contentPane[chip].add(new JScrollPane(forcedStretchPanel), BorderLayout.CENTER); // Finally, we prepare the status bar and add it at the bottom statusBar[chip] = new JLabel(statusText[chip]); statusBar[chip].setOpaque(true); statusBar[chip].setBackground(STATUS_BGCOLOR_DEFAULT); statusBar[chip].setMinimumSize(new Dimension(0, 0)); contentPane[chip].add(statusBar[chip], BorderLayout.SOUTH); } setIconImages(Arrays.asList( Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_16x16.png")), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_20x20.png")), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_24x24.png")), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_32x32.png")), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_64x64.png")))); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, contentPane[Constants.CHIP_FR], contentPane[Constants.CHIP_TX]); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(0.5); setContentPane(splitPane); applyPrefsToUI(); for (int chip = 0; chip < 2; chip++) { if (imageFile[chip] != null) { // There was a command line argument. if (imageFile[chip].exists()) { initialize(chip); } else { JOptionPane.showMessageDialog(this, "Given " + Constants.CHIP_LABEL[chip] + " firmware file does not exist:\n" + imageFile[chip].getAbsolutePath(), "File not found", JOptionPane.WARNING_MESSAGE); } } else { // Check if a FW file is stored in the prefs String firmwareFilename = prefs.getFirmwareFilename(chip); if (firmwareFilename != null) { File firmwareFile = new File(firmwareFilename); if (firmwareFile.exists()) { imageFile[chip] = firmwareFile; initialize(chip); } else { JOptionPane.showMessageDialog(this, Constants.CHIP_LABEL[chip] + " firmware file stored in preference file cannot be found:\n" + firmwareFile.getAbsolutePath(), "File not found", JOptionPane.WARNING_MESSAGE); } } } } framework.setupCallbacks(getCallbackHandler(0), getCallbackHandler(1)); restoreMainWindowSettings(); pack(); updateStates(); //Make dragging a little faster but perhaps uglier. // mdiPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); // Update title bars with emulator statistics every second new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { updateStatusBar(Constants.CHIP_FR); updateStatusBar(Constants.CHIP_TX); } }).start(); }
From source file:org.jets3t.apps.cockpit.Cockpit.java
/** * Initialises the application's GUI elements. *//* w w w .ja va2 s. c om*/ private void initGui() { initMenus(); JPanel appContent = new JPanel(new GridBagLayout()); this.getContentPane().add(appContent); // Buckets panel. JPanel bucketsPanel = new JPanel(new GridBagLayout()); JButton bucketActionButton = new JButton(); bucketActionButton.setToolTipText("Bucket actions menu"); guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png"); bucketActionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton) e.getSource(); bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight()); } }); bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); bucketTableModel = new BucketTableModel(false); bucketTableModelSorter = new TableSorter(bucketTableModel); bucketsTable = new JTable(bucketTableModelSorter); bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader()); bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); bucketsTable.getSelectionModel().addListSelectionListener(this); bucketsTable.setShowHorizontalLines(true); bucketsTable.setShowVerticalLines(false); bucketsTable.addMouseListener(new ContextMenuListener()); bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); // Filter panel. filterObjectsPanel = new JPanel(new GridBagLayout()); filterObjectsPrefix = new JTextField(); filterObjectsPrefix.setToolTipText("Only show objects with this prefix"); filterObjectsPrefix.addActionListener(this); filterObjectsPrefix.setActionCommand("RefreshObjects"); filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" }); filterObjectsDelimiter.setEditable(true); filterObjectsDelimiter.setToolTipText("Object name delimiter"); filterObjectsDelimiter.addActionListener(this); filterObjectsDelimiter.setActionCommand("RefreshObjects"); filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); filterObjectsPanel.setVisible(false); // Objects panel. JPanel objectsPanel = new JPanel(new GridBagLayout()); int row = 0; filterObjectsCheckBox = new JCheckBox("Filter objects"); filterObjectsCheckBox.addActionListener(this); filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed"); objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); JButton objectActionButton = new JButton(); objectActionButton.setToolTipText("Object actions menu"); guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png"); objectActionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton) e.getSource(); objectActionMenu.show(sourceButton, 0, sourceButton.getHeight()); } }); objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsTable = new JTable(); objectTableModel = new ObjectTableModel(); objectTableModelSorter = new TableSorter(objectTableModel); objectTableModelSorter.setTableHeader(objectsTable.getTableHeader()); objectsTable.setModel(objectTableModelSorter); objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() { private static final long serialVersionUID = 301092191828910402L; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue()); return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column); } }); objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() { private static final long serialVersionUID = 7285511556343895652L; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Date date = (Date) value; return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus, row, column); } }); objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); objectsTable.getSelectionModel().addListSelectionListener(this); objectsTable.setShowHorizontalLines(true); objectsTable.setShowVerticalLines(true); objectsTable.addMouseListener(new ContextMenuListener()); objectsTableSP = new JScrollPane(objectsTable); objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this); objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER); objectsSummaryLabel.setFocusable(false); objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); // Combine sections. JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); // Set preferred sizes int preferredWidth = 800; int preferredHeight = 600; this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight))); splitPane.setResizeWeight(0.30); // Initialize drop target. initDropTarget(new JComponent[] { objectsTableSP, objectsTable }); objectsTable.getDropTarget().setActive(false); objectsTableSP.getDropTarget().setActive(false); }