List of usage examples for javax.swing JSplitPane setOneTouchExpandable
@BeanProperty(description = "UI widget on the divider to quickly expand/collapse the divider.") public void setOneTouchExpandable(boolean newValue)
oneTouchExpandable
property, which must be true
for the JSplitPane
to provide a UI widget on the divider to quickly expand/collapse the divider. From source file:org.ash.history.detail.DetailsPanelH.java
/** * Add ChartPanel to mainPanel//from w w w . j a va2s . co m * @param waitClass */ private void addChartPanelT(String waitClass) { JSplitPane splitPaneMainDetail = new JSplitPane(); StackedChartDetail stackedChartMainObjectDetail = new StackedChartDetail(database, waitClass); ChartPanel chartDetailPanel = stackedChartMainObjectDetail.createChartPanel(); stackedChartMainObjectDetail.setThresholdMaxCpu(this.maxCpu); GanttDetailsH sqlsAndSessions = new GanttDetailsH(database, waitClass); chartDetailPanel.addListenerReleaseMouse(sqlsAndSessions); database.clearStackedXYAreaChartDetail(); database.saveStackedXYAreaChartDetail(stackedChartMainObjectDetail, waitClass); database.initialLoadingDataToChartPanelDataSetDetail(waitClass, this.beginTime, this.endTime); stackedChartMainObjectDetail.setTitle(); this.mainPanel.removeAll(); splitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPaneMainDetail.add(chartDetailPanel, "top"); splitPaneMainDetail.add(sqlsAndSessions, "bottom"); splitPaneMainDetail.setDividerLocation(215); splitPaneMainDetail.setOneTouchExpandable(true); this.mainPanel.add(splitPaneMainDetail, BorderLayout.CENTER); this.validate(); this.repaint(); }
From source file:com.vgi.mafscaling.LogView.java
private void createDataTab() { JPanel dataPanel = new JPanel(new BorderLayout()); add(dataPanel, "<html><div style='text-align: center;'>D<br>a<br>t<br>a</div></html>"); createToolBar(dataPanel);//from ww w. j a va 2 s. co m createLogViewPanel(); createGraghPanel(); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, logViewPanel, chartPanel); splitPane.setResizeWeight(0.5); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); splitPane.setDividerLocation(150); dataPanel.add(splitPane); }
From source file:edu.ku.brc.specify.utilapps.RegisterApp.java
/** * //w ww . j a va2s . c o m */ protected void createUI() { JTabbedPane tabbedPane = new JTabbedPane(); rp = new RegProcessor(); rp.processSQL(); tree = new JTree(rp.getRoot(INCL_ANON)); propsTable = new JTable(); tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { fillPropsTable(); } }); tree.setCellRenderer(new MyTreeCellRenderer()); Component topComp = UIHelper.createScrollPane(tree); Component botComp = UIHelper.createScrollPane(propsTable); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComp, botComp); splitPane.setDividerLocation(0.5); splitPane.setOneTouchExpandable(true); splitPane.setLastDividerLocation(300); Dimension minimumSize = new Dimension(200, 400); topComp.setMinimumSize(minimumSize); botComp.setMinimumSize(minimumSize); tabbedPane.add("Registration", splitPane); final List<Pair<String, String>> trackDescPairs = rp.getTrackKeyDescPairs(); Vector<String> trkItems = new Vector<String>(); for (Pair<String, String> p : trackDescPairs) { trkItems.add(p.second); } //Collections.sort(trkItems); final JList list = new JList(trkItems); //pb.add(UIHelper.createScrollPane(list), cc.xy(1, 1)); list.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int inx = list.getSelectedIndex(); if (inx > -1) { fillUsageItemsList(trackDescPairs.get(inx).first); } } } }); tabbedPane.add("Reg Stats", getStatsPane("Registration", rp.getRegNumHash().values(), "register")); DefaultListModel model = new DefaultListModel(); trackItemsList = new JList(model); topComp = UIHelper.createScrollPane(list); botComp = UIHelper.createScrollPane(trackItemsList); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComp, botComp); splitPane.setDividerLocation(0.5); splitPane.setOneTouchExpandable(true); topComp.setMinimumSize(minimumSize); botComp.setMinimumSize(minimumSize); splitPane.setDividerLocation(0.5); trackUsageHash = rp.getTrackCatsHash(); tabbedPane.add("Usage Tracking", splitPane); tabbedPane.add("User Stats", getStatsPane("Tracking", rp.getTrackIdHash().values(), "track")); add(tabbedPane, BorderLayout.CENTER); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.PanelDescricaoImagens.java
private void initComponentsEscalavel(ArrayList<FerramentaDescricaoModel> erros) { Ferramenta_Imagens.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); textAreaSourceCode = new G_TextAreaSourceCode(); textAreaSourceCode.setTipoHTML();/*from w ww. j a v a 2s.co m*/ new OnChange(textAreaSourceCode, this); // parentFrame.setTitle("Associador de rtulos"); tableLinCod = new TabelaDescricao(this, erros); arTextPainelCorrecao = new ArTextPainelCorrecao(this); // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel(); analiseSistematica = new JButton(); salvar = new JButton(); abrir = new JButton(); cancelar = new JButton(); strConteudoalt = new String(); // panelLegenda = new JPanel(); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); 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(); /** * Mostra pro usurio a imagem que est sem descrio */ imagemSemDesc = new XHTMLPanel(); pnBotoes = new JPanel(); salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar, new JMenuItem(), parentFrame); adicionar = new JButton(); aplicar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); analiseSistematica.setEnabled(false); // setJMenuBar(this.criaMenuBar()); // ======== this ======== // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos // controles:"); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); // ======== 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)); } // 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 ======== // ---- Salvar ---- salvar.setText(Ferramenta_Imagens.BTN_SALVAR); salvar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarActionPerformed(e); } }); salvar.setToolTipText(Ferramenta_Imagens.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_SALVAR); salvar.setBounds(10, 0, 150, 25); abrir.setText(Ferramenta_Imagens.BTN_ABRIR); abrir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AbrirActionPerformed(e); } }); abrir.setToolTipText(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.setBounds(165, 0, 150, 25); cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.setBounds(320, 0, 150, 25); analiseSistematica.setText(GERAL.ANALISE_SISTEMATICA); analiseSistematica.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { buttonAction = e; Thread t = new Thread(new Runnable() { public void run() { PainelStatusBar.showProgTarReq(); parentFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); analiseSistematicaActionPerformed(buttonAction); parentFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); PainelStatusBar.hideProgTarReq(); } }); t.setPriority(9); t.start(); } }); analiseSistematica.setToolTipText(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.getAccessibleContext().setAccessibleName(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.setBounds(480, 0, 150, 25); // ======== pnParticRotulo ======== 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; pnSetaDescricao.setLayout(layout); cons.anchor = GridBagConstraints.SOUTHEAST; cons.insets = new Insets(0, 0, 0, 10); conteudoDoAlt.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent arg0) { } public void keyTyped(KeyEvent arg0) { } public void keyReleased(KeyEvent arg0) { if (conteudoDoAlt.getText().length() == 0) { System.out.println("conteudo vazio"); aplicar.setEnabled(false); } else if (tableLinCod.getSelectedRow() != -1) { System.out.println("com conteudo"); aplicar.setEnabled(true); } } }); // ======== spParticRotulo ======== { spTextoDescricao.setViewportView(conteudoDoAlt); } // 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 ======== { pnListaErros.setBorder(criaBorda(Ferramenta_Imagens.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tableLinCod); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- adicionar.setText(Ferramenta_Imagens.BTN_ADICIONAR); adicionar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { adicionarActionPerformed(e); } }); 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); // ---- aplicarRotulo ---- aplicar.setEnabled(false); aplicar.setText(Ferramenta_Imagens.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); 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); textAreaSourceCode.setBorder(criaBorda("")); textAreaSourceCode.setBackground(CoresDefault.getCorPaineis()); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); // JScrollPane ajudaScrollPane = new // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode); splitPane.setOneTouchExpandable(true); // splitPane.set // splitPane.setDividerLocation(0.95); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); // 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); 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)); pnSalvarCancelar.add(salvar); pnSalvarCancelar.add(abrir); pnSalvarCancelar.add(cancelar); if (!original) { reverter = new JButton("Reverter"); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); parentFrame.showPainelFerramentaImgPArq(TxtBuffer.getContentOriginal(), enderecoPagina); setVisible(true); } }); //reverter.setActionCommand("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); if (EstadoSilvinha.conteudoEmPainelResumo) { reverter.setBounds(640, 0, 150, 25); } else { reverter.setBounds(480, 0, 150, 25); } pnSalvarCancelar.add(reverter); } if (EstadoSilvinha.conteudoEmPainelResumo) { pnSalvarCancelar.add(analiseSistematica); } pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); pnListaErros.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); if (tableLinCod.getRowCount() == 0) tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS); contentPane.setBackground(CoresDefault.getCorPaineis()); contentPane.add(textoErrosBtn); this.setVisible(true); }
From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java
/** * Initialize GUI components./*from ww w.j a va 2 s. c om*/ */ @SuppressWarnings({ "rawtypes", "unchecked" }) private void initGUI() { App.init(); // setBounds(100, 100, 972, 439); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setIconImage(Builder.getApplicationIcon()); setTitle("Sample Size Analysis"); getContentPane().setLayout(new MigLayout("", "[1136px,grow,fill]", "[30px][405px,grow]")); JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); getContentPane().add(toolBar, "cell 0 0,growx,aligny top"); JToolBarButton btnOpen = new JToolBarButton(actionBrowse); btnOpen.setIcon(Builder.getImageIcon("fileopen.png")); toolBar.add(btnOpen); JToolBarButton btnSave = new JToolBarButton(actionSaveTable); btnSave.setIcon(Builder.getImageIcon("save.png")); toolBar.add(btnSave); JToolBarButton btnExportPDF = new JToolBarButton(actionExportPDF); btnExportPDF.setIcon(Builder.getImageIcon("pdf.png")); toolBar.add(btnExportPDF); JToolBarButton btnExportPNG = new JToolBarButton(actionExportPNG); btnExportPNG.setIcon(Builder.getImageIcon("formatpng.png")); toolBar.add(btnExportPNG); toolBar.addSeparator(); JToolBarButton btnRun = new JToolBarButton(actionRun); btnRun.setIcon(Builder.getImageIcon("run.png")); toolBar.add(btnRun); JPanel panelMain = new JPanel(); getContentPane().add(panelMain, "cell 0 1,grow"); panelMain.setLayout(new BorderLayout(0, 0)); JSplitPane splitPaneMain = new JSplitPane(); splitPaneMain.setOneTouchExpandable(true); panelMain.add(splitPaneMain); JPanel panelParameters = new JPanel(); splitPaneMain.setLeftComponent(panelParameters); panelParameters.setLayout(new MigLayout("", "[grow,right]", "[][][][193.00,grow,fill][]")); JPanel panelInput = new JPanel(); panelInput.setBorder(new TitledBorder(null, "Input", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelParameters.add(panelInput, "cell 0 0,grow"); panelInput.setLayout(new MigLayout("", "[100px:100px:180px,right][grow,fill][]", "[]")); JLabel lblInputFile = new JLabel("Input file:"); panelInput.add(lblInputFile, "cell 0 0"); txtInputFile = new JTextField(); panelInput.add(txtInputFile, "cell 1 0,growx"); txtInputFile.setActionCommand("NewFileTyped"); txtInputFile.addActionListener(this); txtInputFile.setColumns(10); JButton btnBrowse = new JButton(""); panelInput.add(btnBrowse, "cell 2 0"); btnBrowse.setAction(actionBrowse); btnBrowse.setText(""); btnBrowse.setIcon(Builder.getImageIcon("fileopen16.png")); btnBrowse.setPreferredSize(new Dimension(25, 25)); btnBrowse.setMaximumSize(new Dimension(25, 25)); btnBrowse.putClientProperty("JButton.buttonType", "segmentedTextured"); btnBrowse.putClientProperty("JButton.segmentPosition", "middle"); JPanel panelAnalysisOptions = new JPanel(); panelAnalysisOptions.setBorder(new TitledBorder(null, "Analysis and filtering options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelParameters.add(panelAnalysisOptions, "cell 0 1,grow"); panelAnalysisOptions.setLayout(new MigLayout("", "[100px:100px:180px,right][grow][][]", "[][][][][]")); JLabel lblEventTypes = new JLabel("Event type:"); panelAnalysisOptions.add(lblEventTypes, "cell 0 0"); cboEventType = new JComboBox(); panelAnalysisOptions.add(cboEventType, "cell 1 0 3 1"); cboEventType.setModel(new DefaultComboBoxModel(EventTypeToProcess.values())); new EventTypeWrapper(cboEventType, PrefKey.EVENT_TYPE_TO_PROCESS, EventTypeToProcess.FIRE_EVENT); chkCommonYears = new JCheckBox("<html>Only analyze years all series have in common"); chkCommonYears.setEnabled(false); new CheckBoxWrapper(chkCommonYears, PrefKey.SSIZ_CHK_COMMON_YEARS, false); panelAnalysisOptions.add(chkCommonYears, "cell 1 1 3 1"); chkExcludeSeriesWithNoEvents = new JCheckBox("<html>Exclude series/segments with no events"); chkExcludeSeriesWithNoEvents.setEnabled(false); new CheckBoxWrapper(chkExcludeSeriesWithNoEvents, PrefKey.SSIZ_CHK_EXCLUDE_SERIES_WITH_NO_EVENTS, false); panelAnalysisOptions.add(chkExcludeSeriesWithNoEvents, "cell 1 2 3 1"); JLabel lblThresholdType = new JLabel("Threshold:"); panelAnalysisOptions.add(lblThresholdType, "cell 0 3"); cboThresholdType = new JComboBox(); panelAnalysisOptions.add(cboThresholdType, "cell 1 3"); cboThresholdType.setModel(new DefaultComboBoxModel(FireFilterType.values())); new FireFilterTypeWrapper(cboThresholdType, PrefKey.COMPOSITE_FILTER_TYPE_WITH_ALL_TREES, FireFilterType.NUMBER_OF_EVENTS); JLabel label = new JLabel(">="); panelAnalysisOptions.add(label, "flowx,cell 2 3"); spnThresholdValueGT = new JSpinner(); panelAnalysisOptions.add(spnThresholdValueGT, "cell 3 3"); spnThresholdValueGT.setModel(new SpinnerNumberModel(1, 1, 999, 1)); new SpinnerWrapper(spnThresholdValueGT, PrefKey.COMPOSITE_FILTER_VALUE, 1); chkEnableLessThan = new JCheckBox(""); chkEnableLessThan.setActionCommand("LessThanThresholdStatus"); chkEnableLessThan.addActionListener(this); panelAnalysisOptions.add(chkEnableLessThan, "flowx,cell 1 4,alignx right"); lblLessThan = new JLabel("<="); lblLessThan.setEnabled(false); panelAnalysisOptions.add(lblLessThan, "cell 2 4"); spnThresholdValueLT = new JSpinner(); spnThresholdValueLT.setEnabled(false); spnThresholdValueLT.setModel(new SpinnerNumberModel(1, 1, 999, 1)); panelAnalysisOptions.add(spnThresholdValueLT, "cell 3 4"); lblAnd = new JLabel("and"); panelAnalysisOptions.add(lblAnd, "cell 1 4"); JPanel panelSimulations = new JPanel(); panelSimulations.setBorder( new TitledBorder(null, "Simulations", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelParameters.add(panelSimulations, "cell 0 2,grow"); panelSimulations.setLayout(new MigLayout("", "[100px:100px:180px,right][fill]", "[][][]")); JLabel lblSimulations = new JLabel("Simulations:"); panelSimulations.add(lblSimulations, "cell 0 0"); spnSimulations = new JSpinner(); panelSimulations.add(spnSimulations, "cell 1 0"); spnSimulations.setModel(new SpinnerNumberModel(new Integer(1000), new Integer(1), null, new Integer(1))); new SpinnerWrapper(spnSimulations, PrefKey.SSIZ_SIMULATION_COUNT, 1000); JLabel lblSeedNumber = new JLabel("Seed number:"); panelSimulations.add(lblSeedNumber, "cell 0 1"); spnSeed = new JSpinner(); panelSimulations.add(spnSeed, "cell 1 1"); spnSeed.setModel(new SpinnerNumberModel(new Integer(30188), null, null, new Integer(1))); new SpinnerWrapper(spnSeed, PrefKey.SSIZ_SEED_NUMBER, 30188); JLabel lblResampling = new JLabel("Resampling:"); panelSimulations.add(lblResampling, "cell 0 2"); cboResampling = new JComboBox(); panelSimulations.add(cboResampling, "cell 1 2"); cboResampling .setModel(new DefaultComboBoxModel(new String[] { "With replacement", "Without replacement" })); new ResamplingTypeWrapper(cboResampling, PrefKey.SSIZ_RESAMPLING_TYPE, ResamplingType.WITH_REPLACEMENT); segmentationPanel = new SegmentationPanel(); segmentationPanel.chkSegmentation.setText("Process subset or segments of dataset?"); segmentationPanel.chkSegmentation.setEnabled(false); panelParameters.add(segmentationPanel, "cell 0 3,growx"); JPanel panel_3 = new JPanel(); panelParameters.add(panel_3, "cell 0 4,grow"); panel_3.setLayout(new MigLayout("", "[left][grow][right]", "[]")); JButton btnReset = new JButton("Reset"); btnReset.setActionCommand("Reset"); btnReset.addActionListener(this); panel_3.add(btnReset, "cell 0 0,grow"); JButton btnRunAnalysis = new JButton("Run Analysis"); btnRunAnalysis.setAction(actionRun); panel_3.add(btnRunAnalysis, "cell 2 0,grow"); JPanel panelResults = new JPanel(); splitPaneMain.setRightComponent(panelResults); panelResults.setLayout(new BorderLayout(0, 0)); splitPaneResults = new JSplitPane(); splitPaneResults.setResizeWeight(0.5); splitPaneResults.setOneTouchExpandable(true); splitPaneResults.setDividerLocation(0.5d); panelResults.add(splitPaneResults, BorderLayout.CENTER); splitPaneResults.setOrientation(JSplitPane.VERTICAL_SPLIT); JPanel panelResultsTop = new JPanel(); splitPaneResults.setLeftComponent(panelResultsTop); panelResultsTop.setLayout(new BorderLayout(0, 0)); JPanel panelChartOptions = new JPanel(); panelChartOptions.setBackground(Color.WHITE); panelResultsTop.add(panelChartOptions, BorderLayout.SOUTH); panelChartOptions.setLayout(new MigLayout("", "[][][][][][grow][grow]", "[15px,center]")); JLabel lblNewLabel = new JLabel("Plot:"); panelChartOptions.add(lblNewLabel, "cell 0 0,alignx trailing,aligny center"); cboChartMetric = new JComboBox(); cboChartMetric.setEnabled(false); cboChartMetric.setModel(new DefaultComboBoxModel(MiddleMetric.values())); panelChartOptions.add(cboChartMetric, "cell 1 0,growx"); cboChartMetric.setBackground(Color.WHITE); JLabel lblOfSegment = new JLabel("of segment:"); panelChartOptions.add(lblOfSegment, "cell 2 0,alignx trailing"); cboSegment = new JComboBox(); cboSegment.setBackground(Color.WHITE); cboSegment.setActionCommand("UpdateChart"); cboSegment.addActionListener(this); panelChartOptions.add(cboSegment, "cell 3 0,growx"); cboChartMetric.setActionCommand("UpdateChart"); JLabel lblWithAsymptoteType = new JLabel("with asymptote type:"); panelChartOptions.add(lblWithAsymptoteType, "cell 4 0,alignx trailing"); JComboBox comboBox = new JComboBox(); comboBox.setEnabled(false); comboBox.setModel(new DefaultComboBoxModel(new String[] { "none", "Weibull", "Michaelis-Menten", "Modified Michaelis-Menten", "Logistic", "Modified exponential" })); comboBox.setBackground(Color.WHITE); panelChartOptions.add(comboBox, "cell 5 0,growx"); cboChartMetric.addActionListener(this); panelChart = new JPanel(); panelChart.setMinimumSize(new Dimension(200, 200)); panelResultsTop.add(panelChart, BorderLayout.CENTER); panelChart.setLayout(new BorderLayout(0, 0)); panelChart.setBackground(Color.WHITE); JTabbedPane panelResultsBottom = new JTabbedPane(JTabbedPane.BOTTOM); splitPaneResults.setRightComponent(panelResultsBottom); simulationsTable = new SSIZResultsTable(); simulationsTable.setEnabled(false); simulationsTable.addMouseListener(new TablePopClickListener()); simulationsTable.setVisibleRowCount(10); adapter = new JTableSpreadsheetByRowAdapter(simulationsTable); scrollPaneSimulations = new JScrollPane(); panelResultsBottom.addTab("Simulations", null, scrollPaneSimulations, null); scrollPaneSimulations.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPaneSimulations.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPaneSimulations.setViewportView(simulationsTable); JPanel panelAsymptote = new JPanel(); asymptoteTable = new AsymptoteTable(); asymptoteTable.setEnabled(false); // asymptoteTable.addMouseListener(new TablePopClickListener()); asymptoteTable.setVisibleRowCount(10); scrollPaneAsymptote = new JScrollPane(); scrollPaneAsymptote.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPaneAsymptote.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPaneAsymptote.setViewportView(asymptoteTable); panelAsymptote.setLayout(new BorderLayout()); panelAsymptote.add(scrollPaneAsymptote, BorderLayout.CENTER); panelResultsBottom.addTab("Asymptote", null, panelAsymptote, null); // Disable asymptote tab until it is implemented panelResultsBottom.setEnabledAt(1, false); panelProgressBar = new JPanel(); panelProgressBar.setLayout(new BorderLayout()); btnCancelAnalysis = new JButton("Cancel"); btnCancelAnalysis.setIcon(Builder.getImageIcon("delete.png")); btnCancelAnalysis.setVisible(false); btnCancelAnalysis.setActionCommand("CancelAnalysis"); btnCancelAnalysis.addActionListener(this); progressBar = new JProgressBar(); panelProgressBar.add(progressBar, BorderLayout.CENTER); panelProgressBar.add(btnCancelAnalysis, BorderLayout.EAST); progressBar.setStringPainted(true); fileDialogWasUsed = false; mouseListenersActive = false; this.setGUIForFHFileReader(); this.setGUIForThresholdStatus(); pack(); this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); setVisible(true); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java
/** * Inicia os componentes/*from www. ja v a 2s .c o m*/ * * @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:org.fhaes.jsea.JSEAFrame.java
/** * Setup the GUI components/*from w ww. java2 s . co m*/ */ private void setupGui() { setTitle("jSEA - Superposed Epoch Analysis"); getContentPane().setLayout(new MigLayout("", "[1200px,grow,fill]", "[][600px,grow,fill]")); initActions(); setupMenu(); setupToolbar(); this.setIconImage(Builder.getApplicationIcon()); { JSplitPane splitPane = new JSplitPane(); splitPane.setOneTouchExpandable(true); getContentPane().add(splitPane, "cell 0 1,alignx left,aligny top"); splitPane.setLeftComponent(contentPanel); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPanel.setLayout(new MigLayout("", "[grow,fill]", "[78.00][][][grow][]")); { JPanel panel = new JPanel(); panel.setBorder( new TitledBorder(null, "Input Files", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 0,grow"); panel.setLayout(new MigLayout("", "[][][grow][]", "[][]")); { JLabel lblContinuousTimeSeries = new JLabel("Continuous time series file:"); panel.add(lblContinuousTimeSeries, "cell 0 0,alignx trailing"); } { HelpTipButton label = new HelpTipButton( "Continuous time series data files should be two column comma seperated (CSV) text files. Column one should contains the years (in sequence), and column two should contain the data values. If there are header lines or comments in the file, these lines should beginning with a *"); panel.add(label, "cell 1 0,alignx trailing"); } { txtTimeSeriesFile = new JTextField(); txtwrapper = new TextComponentWrapper(txtTimeSeriesFile, PrefKey.JSEA_CONTINUOUS_TIME_SERIES_FILE, ""); txtTimeSeriesFile.setEditable(true); panel.add(txtTimeSeriesFile, "cell 2 0,growx"); txtTimeSeriesFile.setColumns(10); } { btnTimeSeriesFile = new JButton(); btnTimeSeriesFile.setIcon(Builder.getImageIcon("fileopen16.png")); btnTimeSeriesFile.setActionCommand("TimeSeriesFileBrowse"); btnTimeSeriesFile.addActionListener(this); btnTimeSeriesFile.setPreferredSize(new Dimension(25, 25)); btnTimeSeriesFile.setMaximumSize(new Dimension(25, 25)); btnTimeSeriesFile.putClientProperty("JButton.buttonType", "segmentedTextured"); btnTimeSeriesFile.putClientProperty("JButton.segmentPosition", "middle"); panel.add(btnTimeSeriesFile, "cell 3 0"); } { JLabel lblEventListFile = new JLabel("Event list file:"); panel.add(lblEventListFile, "cell 0 1,alignx trailing"); } { HelpTipButton helpTipButton = new HelpTipButton( "Event data files should be a text file with a single column of integer year values. If there are any header or comment lines, these should begin with a *"); panel.add(helpTipButton, "cell 1 1,alignx trailing"); } { txtEventListFile = new JTextField(); new TextComponentWrapper(txtEventListFile, PrefKey.JSEA_EVENT_LIST_FILE, ""); txtEventListFile.setEditable(false); panel.add(txtEventListFile, "cell 2 1,growx"); txtEventListFile.setColumns(10); } { btnEventListFile = new JButton(); btnEventListFile.setIcon(Builder.getImageIcon("fileopen16.png")); btnEventListFile.setActionCommand("EventListFileBrowse"); btnEventListFile.addActionListener(this); btnEventListFile.setPreferredSize(new Dimension(25, 25)); btnEventListFile.setMaximumSize(new Dimension(25, 25)); btnEventListFile.putClientProperty("JButton.buttonType", "segmentedTextured"); btnEventListFile.putClientProperty("JButton.segmentPosition", "middle"); panel.add(btnEventListFile, "cell 3 1"); } } { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, "Window, Simulation and Statistics", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 1,grow"); panel.setLayout(new MigLayout("", "[right][][fill][10px:10px:10px][right][][90.00,grow,fill]", "[grow][][][]")); { JLabel lblYears = new JLabel("Years to analyse:"); panel.add(lblYears, "cell 0 0"); } { HelpTipButton helpTipButton = new HelpTipButton( "Specify which years from the dataset to analyse."); panel.add(helpTipButton, "cell 1 0"); } { JPanel panel_1 = new JPanel(); panel.add(panel_1, "cell 2 0 5 1,grow"); panel_1.setLayout(new MigLayout("fill, insets 0", "[80px:80px][][80px:80px,fill][grow]", "[]")); { spnFirstYear = new JSpinner(); spnFirstYear.setEnabled(false); panel_1.add(spnFirstYear, "cell 0 0,growx"); spnFirstYear.setModel(new SpinnerNumberModel(new Integer(0), null, null, new Integer(1))); spnFirstYear.setEditor(new JSpinner.NumberEditor(spnFirstYear, "#")); new SpinnerWrapper(spnFirstYear, PrefKey.JSEA_FIRST_YEAR, 0); } { JLabel lblTo = new JLabel("-"); panel_1.add(lblTo, "cell 1 0"); } { spnLastYear = new JSpinner(); spnLastYear.setEnabled(false); panel_1.add(spnLastYear, "cell 2 0"); spnLastYear.setModel(new SpinnerNumberModel(new Integer(2020), null, null, new Integer(1))); spnLastYear.setEditor(new JSpinner.NumberEditor(spnLastYear, "#")); new SpinnerWrapper(spnLastYear, PrefKey.JSEA_LAST_YEAR, 2020); } { chkAllYears = new JCheckBox("all years in series"); chkAllYears.setSelected(true); chkAllYears.setActionCommand("AllYearsCheckbox"); chkAllYears.addActionListener(this); panel_1.add(chkAllYears, "cell 3 0"); } } { JLabel lblLagsPriorTo = new JLabel("Lags prior to event:"); panel.add(lblLagsPriorTo, "cell 0 1"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 1"); } { spnLagsPrior = new JSpinner(); new SpinnerWrapper(spnLagsPrior, PrefKey.JSEA_LAGS_PRIOR_TO_EVENT, 6); panel.add(spnLagsPrior, "cell 2 1,growx"); // spnLagsPrior.setModel(new SpinnerNumberModel(6, 1, 100, 1)); spnLagsPrior.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { segmentationPanel.table.tableModel.clearSegments(); validateForm(); } }); } { JLabel lblSimulationsToRun = new JLabel("Simulations:"); panel.add(lblSimulationsToRun, "cell 4 1"); } { HelpTipButton helpTipButton = new HelpTipButton( "Number of simulations to run. Increasing the number of simulations increases the analysis time."); panel.add(helpTipButton, "cell 5 1"); } { spnSimulationsToRun = new JSpinner(); new SpinnerWrapper(spnSimulationsToRun, PrefKey.JSEA_SIMULATION_COUNT, 1000); panel.add(spnSimulationsToRun, "cell 6 1"); spnSimulationsToRun.setModel(new SpinnerNumberModel(1000, 1, 10096, 1)); } { JLabel lblLagsFollowingThe = new JLabel("Lags following the event:"); panel.add(lblLagsFollowingThe, "cell 0 2"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 2"); } { spnLagsAfter = new JSpinner(); new SpinnerWrapper(spnLagsAfter, PrefKey.JSEA_LAGS_AFTER_EVENT, 4); panel.add(spnLagsAfter, "cell 2 2,growx"); spnLagsAfter.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { segmentationPanel.table.tableModel.clearSegments(); validateForm(); } }); } { JLabel lblSeedNumber = new JLabel("Seed number:"); panel.add(lblSeedNumber, "cell 4 2"); } { HelpTipButton helpTipButton = new HelpTipButton( "The analysis requires a pseudo-random component which is seeded with the seed number (a large integer value). Running analyses with the same seed number enables produces the same results. You can leave the seed as the default number unless you specifically want to generate results from a different randomised pool."); panel.add(helpTipButton, "cell 5 2"); } { spnSeedNumber = new JSpinner(); new SpinnerWrapper(spnSeedNumber, PrefKey.JSEA_SEED_NUMBER, 30188); panel.add(spnSeedNumber, "cell 6 2"); spnSeedNumber.setModel(new SpinnerNumberModel(30188, 10000, 1000000, 1)); } { JLabel lblIncludeIncompleteWindow = new JLabel("Include incomplete epoch:"); panel.add(lblIncludeIncompleteWindow, "cell 0 3"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 3"); } { chkIncludeIncompleteWindow = new JCheckBox(""); new CheckBoxWrapper(chkIncludeIncompleteWindow, PrefKey.JSEA_INCLUDE_INCOMPLETE_WINDOW, false); panel.add(chkIncludeIncompleteWindow, "cell 2 3"); } { JLabel lblPvalue = new JLabel("p-value:"); panel.add(lblPvalue, "cell 4 3"); } { HelpTipButton helpTipButton = new HelpTipButton( "The cutoff value to use for statistical significance"); panel.add(helpTipButton, "cell 5 3,alignx trailing"); } { cbxPValue = new JComboBox(); panel.add(cbxPValue, "cell 6 3"); cbxPValue.setModel(new DefaultComboBoxModel(new Double[] { 0.05, 0.01, 0.001 })); } } { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, "Chart Options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 2,grow"); panel.setLayout(new MigLayout("", "[right][][grow]", "[][]")); { JLabel lblTitleOfChart = new JLabel("Title of chart:"); panel.add(lblTitleOfChart, "cell 0 0,alignx trailing"); } { HelpTipButton helpTipButton = new HelpTipButton( "Title to use on the chart. The placeholder {segment} is replaced with the years of the segment being plotted."); panel.add(helpTipButton, "cell 1 0,alignx trailing"); } { txtChartTitle = new JTextField(); txtChartTitle.setToolTipText("<html>Title to be displayed on the<br/>" + "chart output"); new TextComponentWrapper(txtChartTitle, PrefKey.JSEA_CHART_TITLE, "Chart title {segment}"); panel.add(txtChartTitle, "cell 2 0,growx,aligny top"); txtChartTitle.setColumns(10); } { JLabel lblYaxisLabel = new JLabel("Continuous series (y-axis) label"); panel.add(lblYaxisLabel, "cell 0 1,alignx trailing"); } { txtYAxisLabel = new JTextField(); txtYAxisLabel .setToolTipText("<html>Label to be displayed on the<br/> " + "continuous series axis"); new TextComponentWrapper(txtYAxisLabel, PrefKey.JSEA_YAXIS_LABEL, "Y Axis"); panel.add(txtYAxisLabel, "cell 2 1,growx"); txtYAxisLabel.setColumns(10); } } { // Segmentation implementation used from FHSampleSize segmentationPanel = new SegmentationPanel(); segmentationPanel.chkSegmentation.setText("Process subset or segments of events?"); segmentationPanel.chkSegmentation.setActionCommand("SegmentationMode"); segmentationPanel.chkSegmentation.addActionListener(this); contentPanel.add(segmentationPanel, "cell 0 3,grow"); } { tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM); splitPane.setRightComponent(tabbedPane); { summaryPanel = new JPanel(); tabbedPane.addTab("Summary ", Builder.getImageIcon("info.png"), summaryPanel, null); summaryPanel.setLayout(new BorderLayout(0, 0)); { scrollPane = new JScrollPane(); summaryPanel.add(scrollPane); { txtSummary = new JTextArea(); txtSummary.setEditable(false); scrollPane.setViewportView(txtSummary); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(scrollPane, popup); popup.add(mntmCopy); } } } { dataPanel = new JPanel(); tabbedPane.addTab("Data ", Builder.getImageIcon("table.png"), dataPanel, null); dataPanel.setLayout(new MigLayout("", "[grow,fill]", "[grow]")); { JSplitPane splitPaneDataTables = new JSplitPane(); splitPaneDataTables.setResizeWeight(0.5); splitPaneDataTables.setOneTouchExpandable(true); splitPaneDataTables.setOrientation(JSplitPane.VERTICAL_SPLIT); dataPanel.add(splitPaneDataTables, "cell 0 0,grow"); { JPanel panel = new JPanel(); splitPaneDataTables.setLeftComponent(panel); panel.setBorder(new TitledBorder(null, "Actual key events", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setLayout(new MigLayout("", "[227.00px,grow,fill]", "[68.00px,grow,fill]")); { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 0 0,grow"); { tblActual = new JXTable(); adapterActualTable = new JTableSpreadsheetByRowAdapter(tblActual); scrollPane.setViewportView(tblActual); tblActual.setSortable(false); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(tblActual, popup); popup.add(mntmCopy); } } } { JPanel panel = new JPanel(); splitPaneDataTables.setRightComponent(panel); panel.setBorder(new TitledBorder(null, "Simulation results", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setLayout(new MigLayout("", "[grow,fill]", "[grow,fill]")); { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 0 0,grow"); { tblSimulation = new JXTable(); adapterSimulationTable = new JTableSpreadsheetByRowAdapter(tblSimulation); scrollPane.setViewportView(tblSimulation); tblSimulation.setSortable(false); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(tblSimulation, popup); popup.add(mntmCopy); } } } splitPaneDataTables.setDividerLocation(0.5f); } } { chartPanel = new JPanel(); tabbedPane.addTab("Chart ", Builder.getImageIcon("barchart.png"), chartPanel, null); chartPanel.setLayout(new MigLayout("", "[][grow]", "[][grow]")); { segmentComboBox = new JComboBox(); segmentComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent arg0) { if (segmentComboBox.getItemCount() > 0) { barChart = new JSEABarChart( jsea.getChartList().get(segmentComboBox.getSelectedIndex())); barChart.setMaximumDrawHeight(MAX_DRAW_HEIGHT); barChart.setMaximumDrawWidth(MAX_DRAW_WIDTH); chartPanel.removeAll(); chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center"); chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center"); chartPanel.add(barChart, "cell 0 1 2 1,grow"); chartPanel.revalidate(); chartPanel.repaint(); } } }); { plotSegmentLabel = new JLabel("Plot Segment: "); chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center"); } chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center"); } } } } pack(); validateForm(); setAnalysisAvailable(false); setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.script.PainelScript.java
private void initComponentsEscalavel(ArrayList<FerramentaDescricaoModel> erros) { Ferramenta_Scripts.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); textAreaSourceCode = new G_TextAreaSourceCode(); textAreaSourceCode.setTipoHTML();/*from w ww . jav a 2 s.c o m*/ new OnChange(textAreaSourceCode, this); tableLinCod = new TabelaDescricao(erros); arTextPainelCorrecao = new ArTextPainelCorrecao(); salvar = new JButton(); abrir = new JButton(); cancelar = new JButton(); strConteudoalt = new String(); btnSalvar = new JMenuItem("Salvar"); salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar, new JMenuItem(), parentFrame); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(); conteudoDoAlt = new JTextArea(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); pnBotoes = new JPanel(); new JButton(); aplicar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); { pnRegra.setBorder(criaBorda(Ferramenta_Scripts.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(Ferramenta_Scripts.REGRAP1); lbRegras2.setText(Ferramenta_Scripts.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); } // ---- Salvar ---- salvar.setText(Ferramenta_Scripts.BTN_SALVAR); salvar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarActionPerformed(e); } }); salvar.setToolTipText(Ferramenta_Scripts.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_SALVAR); salvar.setBounds(10, 0, 150, 25); abrir.setText(Ferramenta_Scripts.BTN_ABRIR); abrir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AbrirActionPerformed(e); } }); abrir.setToolTipText(Ferramenta_Scripts.DICA_ABRIR); abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_ABRIR_HTML); abrir.setBounds(165, 0, 150, 25); cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.setBounds(320, 0, 150, 25); GridBagConstraints cons = new GridBagConstraints(); cons.fill = GridBagConstraints.BOTH; cons.weighty = 1; pnSetaDescricao.setLayout(new BorderLayout()); cons.anchor = GridBagConstraints.WEST; cons.insets = new Insets(0, 0, 0, 0); JScrollPane sp = new JScrollPane(); sp.setBorder(criaBorda(Ferramenta_Scripts.CONTEUDO_ALTER)); sp.setViewportView(conteudoDoAlt); sp.setPreferredSize(new Dimension(500, 300)); pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); pnListaErros.setBorder(criaBorda(Ferramenta_Scripts.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); scrollPanetabLinCod.setViewportView(tableLinCod); pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); { pnBotoes.setLayout(null); aplicar.setEnabled(false); aplicar.setText(Ferramenta_Scripts.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); aplicar.setToolTipText(Ferramenta_Scripts.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_APLICAR); aplicar.setBounds(3, 3, 120, 30); pnBotoes.add(aplicar); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); textAreaSourceCode.setBorder(criaBorda("")); textAreaSourceCode.setBackground(CoresDefault.getCorPaineis()); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode); splitPane.setOneTouchExpandable(true); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); regraFonteBtn.add(splitPane, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnSetaDescricao.setBackground(CoresDefault.getCorPaineis()); pnSetaDescricao.add(pnBotoes, BorderLayout.WEST); textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); pnSalvarCancelar.add(salvar); pnSalvarCancelar.add(abrir); pnSalvarCancelar.add(cancelar); if (!original) { reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); parentFrame.showPainelFerramentaScriptPArq(TxtBuffer.getContentOriginal()); setVisible(true); } }); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(485, 0, 150, 25); pnSalvarCancelar.add(reverter); } pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); pnListaErros.setBackground(CoresDefault.getCorPaineis()); if (tableLinCod.getRowCount() == 0) tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS); contentPane.setBackground(CoresDefault.getCorPaineis()); contentPane.add(textoErrosBtn); this.setVisible(true); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.objeto.PainelObjeto.java
private void initComponentsEscalavel( ArrayList<FerramentaDescricaoModel> erros) { Ferramenta_Objetos.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); scrollPaneDescricao = new G_TextAreaSourceCode(); scrollPaneDescricao.setTipoHTML();//from w w w . j a v a 2 s . c o m new OnChange(scrollPaneDescricao, this); //parentFrame.setJMenuBar(this.criaMenuBar()); // parentFrame.setTitle("Associador de rtulos"); tableLinCod = new TabelaDescricao(erros); arTextPainelCorrecao = new ArTextPainelCorrecao(); // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel(); salvar = new JButton(); abrir = new JButton(); cancelar = new JButton(); strConteudoalt = new String(); // panelLegenda = new JPanel(); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); pnSetaDescricao.setLayout(new BorderLayout()); spTextoDescricao = new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(); conteudoDoAlt = new JTextArea(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); lbTemp = new JLabel(); pnBotoes = new JPanel(); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); adicionar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); // setJMenuBar(this.criaMenuBar()); // ======== this ======== // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos // controles:"); salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(scrollPaneDescricao.getTextPane(), salvar, new JMenuItem(), parentFrame); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); // ======== pnRegra ======== { pnRegra.setBorder(criaBorda(Ferramenta_Objetos.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(Ferramenta_Objetos.REGRAP1); lbRegras2.setText(Ferramenta_Objetos.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); } // G_URLIcon.setIcon(lbTemp, // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg"); // ======== pnDescricao ======== // ---- Salvar ---- salvar.setText(Ferramenta_Objetos.BTN_SALVAR); salvar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarActionPerformed(e); } }); salvar.setToolTipText(Ferramenta_Objetos.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_SALVAR); salvar.setBounds(10, 0, 150, 25); abrir.setText(Ferramenta_Objetos.BTN_ABRIR); abrir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AbrirActionPerformed(e); } }); abrir.setToolTipText(Ferramenta_Objetos.DICA_ABRIR); abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_ABRIR_HTML); abrir.setBounds(165, 0, 150, 25); cancelar.setText(Ferramenta_Objetos.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Objetos.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_TELA_ANTERIOR); cancelar.setBounds(320, 0, 150, 25); // ======== pnParticRotulo ======== // pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT)); // ======== spParticRotulo ======== { // spTextoDescricao.setViewportView(conteudoDoAlt); } // lbRegras1.setText(Reparo_Imagens.REGRAP2); // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); // pnRegra.add(lbRegras1); JScrollPane sp = new JScrollPane(); sp.setViewportView(conteudoDoAlt); sp.setPreferredSize(new Dimension(500, 300)); sp.setBorder(criaBorda(Ferramenta_Objetos.CONTEUDO_ALTER)); // pnSetaDescricao.add(spTextoDescricao,cons); pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); // ======== pnListaErros ======== { pnListaErros.setBorder(criaBorda(Ferramenta_Objetos.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tableLinCod); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- adicionar.setText(Ferramenta_Objetos.BTN_ADICIONAR); adicionar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { adicionarActionPerformed(e); } }); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); scrollPaneDescricao.setBorder(criaBorda("")); scrollPaneDescricao.setBackground(CoresDefault.getCorPaineis()); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); // JScrollPane ajudaScrollPane = new // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, scrollPaneDescricao); splitPane.setOneTouchExpandable(true); // splitPane.set // splitPane.setDividerLocation(0.95); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); // 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); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnSetaDescricao.setBackground(CoresDefault.getCorPaineis()); pnSetaDescricao.add(pnBotoes); aplicar = new JButton(); aplicar.setBounds(3, 3, 120, 30); pnBotoes.add(aplicar); // ---- aplicarRotulo ---- aplicar.setEnabled(false); aplicar.setText(Ferramenta_Objetos.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); aplicar.setToolTipText(Ferramenta_Objetos.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_APLICAR); textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); pnSalvarCancelar.add(salvar); pnSalvarCancelar.add(abrir); pnSalvarCancelar.add(cancelar); if (!original) { reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); parentFrame.showPainelFerramentaDescricaoObjetosPArq(TxtBuffer.getContentOriginal()); setVisible(true); } }); //reverter.setActionCommand("Reverter"); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(485, 0, 150, 25); pnSalvarCancelar.add(reverter); } pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); pnListaErros.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); contentPane.setBackground(CoresDefault.getCorPaineis()); contentPane.add(textoErrosBtn); if (tableLinCod.getRowCount() == 0) tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS); this.setVisible(true); }
From source file:org.jets3t.apps.cockpit.Cockpit.java
/** * Initialises the application's GUI elements. *///from w w w . ja va2s . co m 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); }