List of usage examples for java.awt BorderLayout WEST
String WEST
To view the source code for java.awt BorderLayout WEST.
Click Source Link
From source file:org.kootox.episodesmanager.ui.EpisodesManagerMainUIHandler.java
protected void showAbout(EpisodesManagerMainUI ui) { AboutPanel about = new AboutPanel() { private static final long serialVersionUID = 1L; @Override/*from w w w . j a v a 2 s .co m*/ public void buildTopPanel() { topPanel.setLayout(new BorderLayout()); JLabel labelIcon; Icon logoIcon; logoIcon = Resource.getIcon("/icons/logo-OT_web.png"); labelIcon = new JLabel(logoIcon); topPanel.add(labelIcon, BorderLayout.WEST); logoIcon = Resource.getIcon("/icons/logo_ird.png"); labelIcon = new JLabel(logoIcon); topPanel.add(labelIcon, BorderLayout.EAST); } }; about.setTitle(_("episodesmanager.title.about")); about.setAboutText(_("episodesmanager.about.message")); String bottomText = "Episodes Manager -v." + EpisodesManagerContext.getConfig().getApplicationVersion() + " -Copyright2009 - 2011 Jean Couteau"; about.setBottomText(bottomText); //about.setIconPath("/icons/logo-OT_web.png"); about.setLicenseFile("META-INF/episodesmanager-swing-LICENSE.txt"); about.setThirdpartyFile("META-INF/episodesmanager-swing-THIRD-PARTY.txt"); about.init(); about.showInDialog(ui, true); }
From source file:nz.co.fortytwo.freeboard.installer.InstalManager.java
private void addWidgets() { JTabbedPane tabPane = new JTabbedPane(); this.add(tabPane, BorderLayout.CENTER); // upload to arduinos JPanel uploadPanel = new JPanel(); uploadPanel.setLayout(new BorderLayout()); uploadPanel.add(uploadingPanel, BorderLayout.CENTER); final JPanel westUploadPanel = new JPanel(new MigLayout()); String info = "\nUse this panel to upload compiled code to the arduino devices.\n\n" + "NOTE: directories with spaces will probably not work!\n\n" + "First select the base directory of your Arduino IDE installation, eg C:/devtools/arduino-1.5.2\n\n" + "Then select target files to upload, these are ended in '.hex'\n" + "\nand can be downloaded from github (https://github.com/rob42),\n" + " see the 'Release*' sub-directories\n\n" + "Output of the process will display in the right-side window\n\n"; JTextArea jTextInfo = new JTextArea(info); jTextInfo.setEditable(false);/* www . ja v a2 s. c om*/ westUploadPanel.add(jTextInfo, "span,wrap"); westUploadPanel.add(new JLabel("Select Arduino IDE directory:"), "wrap"); arduinoDirTextField.setEditable(false); westUploadPanel.add(arduinoDirTextField, "span 2"); arduinoIdeChooser.setApproveButtonText("Select"); arduinoIdeChooser.setAcceptAllFileFilterUsed(false); arduinoIdeChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); arduinoIdeChooser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (JFileChooser.APPROVE_SELECTION.equals(evt.getActionCommand())) { toolsDir = new File(arduinoIdeChooser.getSelectedFile(), File.separator + "hardware" + File.separator + "tools" + File.separator); if (!toolsDir.exists()) { toolsDir = null; JOptionPane.showMessageDialog(westUploadPanel, "Not a valid Arduino IDE directory"); return; } arduinoDirTextField.setText(arduinoIdeChooser.getSelectedFile().getAbsolutePath()); } } }); JButton arduinoDirButton = new JButton("Select"); arduinoDirButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { arduinoIdeChooser.showDialog(westUploadPanel, "Select"); } }); westUploadPanel.add(arduinoDirButton, "wrap"); westUploadPanel.add(new JLabel("Select comm port:")); westUploadPanel.add(portComboBox, "wrap"); westUploadPanel.add(new JLabel("Select device:"), "gap unrelated"); westUploadPanel.add(deviceComboBox, "wrap"); hexFileChooser.setApproveButtonText("Upload"); hexFileChooser.setAcceptAllFileFilterUsed(false); hexFileChooser.addChoosableFileFilter(new FileFilter() { @Override public String getDescription() { return "*.hex - Hex file"; } @Override public boolean accept(File f) { if (f.isDirectory()) { return true; } if (f.getName().toUpperCase().endsWith(".HEX")) { return true; } return false; } }); westUploadPanel.add(hexFileChooser, "span, wrap"); uploadPanel.add(westUploadPanel, BorderLayout.WEST); tabPane.addTab("Upload", uploadPanel); // charts JPanel chartPanel = new JPanel(); chartPanel.setLayout(new BorderLayout()); FileNameExtensionFilter filter = new FileNameExtensionFilter("Charts", "tiff", "kap", "KAP", "TIFF", "tif", "TIF"); chartFileChooser.setFileFilter(filter); chartFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chartFileChooser.setMultiSelectionEnabled(true); final JPanel chartWestPanel = new JPanel(new MigLayout()); String info2 = "\nUse this panel to convert charts into the correct format for FreeBoard.\n" + "\nYou need to select the charts or directories containing charts, then click 'Process'.\n " + "\nThe results will be in a directory with the same name as the chart, and the chart " + "\ndirectory will also be compressed into a zip file ready to transfer to your FreeBoard " + "\nserver\n" + "\nOutput of the process will display in the right-side window\n\n"; JTextArea jTextInfo2 = new JTextArea(info2); jTextInfo2.setEditable(false); chartWestPanel.add(jTextInfo2, "wrap"); chartFileChooser.setApproveButtonText("Process"); chartWestPanel.add(chartFileChooser, "span,wrap"); final JPanel loggingPanel = new JPanel(new MigLayout()); loggingGroup.add(infoButton); loggingGroup.add(debugButton); debugButton.setSelected(logger.isDebugEnabled()); infoButton.setSelected(!logger.isDebugEnabled()); infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (infoButton.isSelected()) { LogManager.getRootLogger().setLevel(Level.INFO); } } }); debugButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (debugButton.isSelected()) { LogManager.getRootLogger().setLevel(Level.DEBUG); } } }); loggingPanel.add(new JLabel("Logging Level")); loggingPanel.add(infoButton); loggingPanel.add(debugButton); chartWestPanel.add(loggingPanel, "span,wrap"); final JPanel transparentPanel = new JPanel(new MigLayout()); charsetGroup.add(utf8Button); charsetGroup.add(iso8859Button); iso8859Button.setSelected(logger.isDebugEnabled()); utf8Button.setSelected(!logger.isDebugEnabled()); utf8Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (utf8Button.isSelected()) { charset = "UTF-8"; } } }); iso8859Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (iso8859Button.isSelected()) { charset = "ISO-8859-1"; } } }); transparentPanel.add(new JLabel("KAP Character set:")); transparentPanel.add(utf8Button); transparentPanel.add(iso8859Button); chartWestPanel.add(transparentPanel); chartPanel.add(chartWestPanel, BorderLayout.WEST); chartPanel.add(processingPanel, BorderLayout.CENTER); tabPane.addTab("Charts", chartPanel); // IMU calibration JPanel calPanel = new JPanel(); calPanel.setLayout(new BorderLayout()); JPanel westCalPanel = new JPanel(new MigLayout()); String info3 = "\nUse this panel to calibrate your ArduIMU.\n" + "\nYou should do this as near to the final location as possible,\n" + "and like all compasses, as far from wires and magnetic materials \n" + "as possible.\n" + "\nSelect your comm port, then click 'Start'.\n " + "\nSmoothly and steadily rotate the ArduIMU around all 3 axes (x,y,z)\n" + "several times. Then press stop and the calibration will be performed and\n" + "uploaded to the ArduIMU\n\n" + "Output of the process will display in the right-side window\n\n"; JTextArea jTextInfo3 = new JTextArea(info3); jTextInfo3.setEditable(false); westCalPanel.add(jTextInfo3, "span, wrap"); westCalPanel.add(new JLabel("Select comm port:")); westCalPanel.add(portComboBox1, "wrap"); JButton startCal = new JButton("Start"); startCal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { calibrationPanel.process((String) portComboBox.getSelectedItem()); } }); westCalPanel.add(startCal); JButton stopCal = new JButton("Stop"); stopCal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { calibrationPanel.stopProcess(); } }); westCalPanel.add(stopCal); calPanel.add(westCalPanel, BorderLayout.WEST); calPanel.add(calibrationPanel, BorderLayout.CENTER); tabPane.addTab("Calibration", calPanel); }
From source file:com.joey.software.regionSelectionToolkit.controlers.ImageProfileToolDynamicRangePanel.java
public JPanel getControls() { if (controls == null) { controls = new JPanel(new BorderLayout()); JPanel dirButton = new JPanel(new GridLayout(1, 2)); dirButton.add(moveUpData);/*from w ww. j av a2s. com*/ dirButton.add(moveDownData); JPanel pointsPanel = new JPanel(new BorderLayout()); pointsPanel.add(saveData, BorderLayout.NORTH); pointsPanel.add(numPoints, BorderLayout.CENTER); pointsPanel.add(updatePoints, BorderLayout.EAST); pointsPanel.add(showFlattenedButton, BorderLayout.SOUTH); JPanel offsetPane = new JPanel(new BorderLayout()); offsetPane.add(showOffset, BorderLayout.WEST); offsetPane.add(offset, BorderLayout.CENTER); JPanel temp = new JPanel(new BorderLayout()); temp.add(offsetPane, BorderLayout.NORTH); temp.add(transparance, BorderLayout.CENTER); JPanel toolPanel = new JPanel(new BorderLayout()); toolPanel.add(dirButton, BorderLayout.NORTH); toolPanel.add(pointsPanel, BorderLayout.CENTER); toolPanel.add(temp, BorderLayout.SOUTH); controls.add(toolPanel, BorderLayout.NORTH); transparance.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { panel.repaint(); } }); showOffset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panel.repaint(); } }); offset.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { panel.shapeChanged(); panel.repaint(); } }); showFlattenedButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showFlattenedImage(); } }); updatePoints.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setDataPoints((Integer) numPoints.getValue()); } }); moveUPTimer = new Timer(delay, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(1.0f / view.getImage().getImage().getHeight()); } }); moveDownTimer = new Timer(delay, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(-1.0f / view.getImage().getImage().getHeight()); } }); moveUpData.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JButton btn2 = (JButton) e.getSource(); ButtonModel model = btn2.getModel(); if (model.isPressed() && !moveUPTimer.isRunning()) { moveUPTimer.start(); } else if (!model.isPressed() && moveUPTimer.isRunning()) { moveUPTimer.stop(); } } }); moveDownData.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JButton btn2 = (JButton) e.getSource(); ButtonModel model = btn2.getModel(); if (model.isPressed() && !moveDownTimer.isRunning()) { moveDownTimer.start(); } else if (!model.isPressed() && moveDownTimer.isRunning()) { moveDownTimer.stop(); } } }); moveUpData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(1.0f / view.getImage().getImage().getHeight()); } }); moveDownData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(-1.0f / view.getImage().getImage().getHeight()); } }); saveData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { saveData(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } return controls; }
From source file:org.colombbus.tangara.CommandSelection.java
/** * This method initializes mainPanel//w w w . ja va 2 s .co m * * @return javax.swing.JPanel */ private JPanel getMainPanel() { if (mainPanel == null) { mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(getHelpText(), BorderLayout.NORTH); mainPanel.add(Box.createHorizontalStrut(MARGIN_X), BorderLayout.WEST); mainPanel.add(getCentralPanel(), BorderLayout.CENTER); mainPanel.add(Box.createHorizontalStrut(MARGIN_X), BorderLayout.EAST); mainPanel.add(getPanelButtons(), BorderLayout.SOUTH); } return mainPanel; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java
private void criaInterfaceVisualEscalavel() { miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR); painel = new JPanel(); frameSilvinha.setJMenuBar(this.criaMenuBar()); textAreaSourceCode.setTipoHTML();// w w w . jav a 2 s. c om textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE)); frameSilvinha.setTitle(XHTML_Panel.TIT_CORR_EVT); painel.setLayout(new GridLayout(2, 1)); setBackground(frameSilvinha.corDefault); Container contentPane = this; contentPane.setLayout(new GridLayout(1, 1)); painel.add(textAreaSourceCode); JPanel panelBtnTabela = new JPanel(); panelBtnTabela.setLayout(new BorderLayout()); /* * Barra de botes */ btnPanel = new JPanel(); btnPanel.setLayout(null); btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR); btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR); btn_salvar.setBounds(10, 0, 150, 25); btnPanel.add(btn_salvar); btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR); btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR); btn_abrir.setBounds(165, 0, 150, 25); btnPanel.add(btn_abrir); btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO); btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO); btn_salvarComo.setBounds(320, 0, 150, 25); btnPanel.add(btn_salvarComo); btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR); btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR); btn_cancelar.setBounds(480, 0, 150, 25); btnPanel.add(btn_cancelar); btnPanel.setPreferredSize(new Dimension(430, 30)); /* * Barra de correcao */ btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR); btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR); btnAplicar.setEnabled(false); texto = new JTextField(); texto.setBorder(BorderFactory.createLineBorder(Color.BLACK)); JPanel borda = new JPanel(new BorderLayout()); lbl_texto = new JLabel("JavaScript: "); lbl_texto.setToolTipText(XHTML_Panel.DICA_JAVASCRIPT); borda.add(lbl_texto, BorderLayout.WEST); borda.add(texto, BorderLayout.CENTER); borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); borda.setOpaque(false); panelCorretor = new JPanel(new BorderLayout()); panelCorretor.add(borda, BorderLayout.CENTER); panelCorretor.add(btnAplicar, BorderLayout.EAST); // panelCorretor.add(btnPanel,BorderLayout.WEST); panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); panelCorretor.setOpaque(false); /* * Tabela de erros */ tabelaDeErros = new TabelaErros(); scrollPaneTabela = new JScrollPane(); scrollPaneTabela.setViewportView(tabelaDeErros); panelBtnTabela.add(panelCorretor, BorderLayout.NORTH); panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER); panelBtnTabela.add(btnPanel, BorderLayout.SOUTH); scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS)); painel.add(panelBtnTabela); btnPanel.setBackground(frameSilvinha.corDefault); { reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(480, 0, 150, 25); btnPanel.add(reverter); reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); frameSilvinha.showPainelFerramentaEventoDependente(); setVisible(true); } }); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(640, 0, 150, 25); btnPanel.add(reverter); } panelBtnTabela.setBackground(frameSilvinha.corDefault); painel.setBackground(frameSilvinha.corDefault); contentPane.setBackground(frameSilvinha.corDefault); scrollPaneTabela.setBackground(frameSilvinha.corDefault); textAreaSourceCode.setBackground(frameSilvinha.corDefault); miBtnSalvar.setEnabled(false); btn_salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), btn_salvar, miBtnSalvar, frameSilvinha); String fil[] = { ".html", ".htm" }; salvaAlteracoes.setFiltro(fil); contentPane.add(painel); // pack(); this.setVisible(true); }
From source file:eu.delving.sip.Application.java
private Application(final File storageDir) throws StorageException { GroovyCodeResource groovyCodeResource = new GroovyCodeResource(getClass().getClassLoader()); final ImageIcon backgroundIcon = new ImageIcon(getClass().getResource("/delving-background.png")); desktop = new JDesktopPane() { public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(backgroundIcon.getImage(), 0, 0, desktop); }/*from w ww .ja va2 s . c om*/ }; desktop.setMinimumSize(new Dimension(MINIMUM_DESKTOP_SIZE)); resizeTimer = new Timer(DEFAULT_RESIZE_INTERVAL, new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { resizeTimer.stop(); for (JInternalFrame frame : desktop.getAllFrames()) { if (frame instanceof FrameBase) { ((FrameBase) frame).ensureOnScreen(); } } } }); desktop.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent componentEvent) { resizeTimer.restart(); } }); Preferences preferences = Preferences.userNodeForPackage(SipModel.class); feedback = new VisualFeedback(home, desktop, preferences); HttpClient httpClient = createHttpClient(storageDir); SchemaRepository schemaRepository; try { schemaRepository = new SchemaRepository(new SchemaFetcher(httpClient)); } catch (IOException e) { throw new StorageException("Unable to create Schema Repository", e); } ResolverContext context = new ResolverContext(); Storage storage = new StorageImpl(storageDir, schemaRepository, new CachedResourceResolver(context)); context.setStorage(storage); context.setHttpClient(httpClient); sipModel = new SipModel(desktop, storage, groovyCodeResource, feedback, preferences); CultureHubClient cultureHubClient = isStandalone(storageDir) ? null : new CultureHubClient(sipModel, httpClient); if (cultureHubClient != null) uploadAction = new UploadAction(sipModel, cultureHubClient); expertMenu = new ExpertMenu(desktop, sipModel, cultureHubClient, allFrames); statusPanel = new StatusPanel(sipModel); home = new JFrame(titleString()); home.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent componentEvent) { allFrames.getViewSelector().refreshView(); } }); JPanel content = (JPanel) home.getContentPane(); content.setFocusable(true); FrameBase dataSetFrame = cultureHubClient != null ? new DataSetHubFrame(sipModel, cultureHubClient) : new DataSetStandaloneFrame(sipModel, schemaRepository); LogFrame logFrame = new LogFrame(sipModel); feedback.setLog(logFrame.getLog()); allFrames = new AllFrames(sipModel, content, dataSetFrame, logFrame); desktop.setBackground(new Color(190, 190, 200)); content.add(desktop, BorderLayout.CENTER); sipModel.getMappingModel().addChangeListener(new MappingModel.ChangeListener() { @Override public void lockChanged(MappingModel mappingModel, final boolean locked) { sipModel.exec(new Swing() { @Override public void run() { unlockMappingAction.setEnabled(locked); } }); } @Override public void functionChanged(MappingModel mappingModel, MappingFunction function) { } @Override public void nodeMappingChanged(MappingModel mappingModel, RecDefNode node, NodeMapping nodeMapping, NodeMappingChange change) { } @Override public void nodeMappingAdded(MappingModel mappingModel, RecDefNode node, NodeMapping nodeMapping) { } @Override public void nodeMappingRemoved(MappingModel mappingModel, RecDefNode node, NodeMapping nodeMapping) { } @Override public void populationChanged(MappingModel mappingModel, RecDefNode node) { } }); importAction = new ImportAction(desktop, sipModel); attachAccelerator(importAction, home); validateAction = new ValidateAction(sipModel, allFrames.prepareForInvestigation(desktop)); unlockMappingAction = new UnlockMappingAction(sipModel); attachAccelerator(unlockMappingAction, home); selectAnotherMappingAction = new SelectAnotherMappingAction(sipModel); attachAccelerator(selectAnotherMappingAction, home); content.add(createStatePanel(), BorderLayout.SOUTH); content.add(allFrames.getSidePanel(), BorderLayout.WEST); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); screen.height -= 30; home.setSize(screen); home.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); ImageIcon logo = new ImageIcon(getClass().getResource("/sip-creator-logo.png")); home.setIconImage(logo.getImage()); home.setJMenuBar(createMenuBar()); home.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent windowEvent) { quit(); } }); home.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); sipModel.getDataSetModel().addListener(new DataSetModel.SwingListener() { @Override public void stateChanged(DataSetModel model, DataSetState state) { statusPanel.setState(state); switch (state) { case ABSENT: sipModel.exec(new Work() { @Override public void run() { sipModel.getDataSetFacts().set(null); sipModel.getStatsModel().setStatistics(null); } @Override public Job getJob() { return Job.CLEAR_FACTS_STATS; } }); home.setTitle(titleString()); sipModel.seekReset(); break; default: DataSetModel dataSetModel = sipModel.getDataSetModel(); home.setTitle(String.format(titleString() + " - [%s -> %s]", dataSetModel.getDataSet().getSpec(), dataSetModel.getPrefix().toUpperCase())); sipModel.getReportFileModel().refresh(); break; } } }); attachAccelerator(new QuitAction(), home); attachAccelerator(statusPanel.getButtonAction(), home); }
From source file:LayeredPaneDemo.java
protected void createTitleBar() { m_titlePanel = new JPanel() { public Dimension getPreferredSize() { return new Dimension(InnerFrame.this.getWidth(), m_titleBarHeight); }/*from w w w .j av a 2 s .c om*/ }; m_titlePanel.setLayout(new BorderLayout()); m_titlePanel.setOpaque(true); m_titlePanel.setBackground(TITLE_BAR_BG_COLOR); m_titleLabel = new JLabel(); m_titleLabel.setForeground(Color.black); m_close = new InnerFrameButton(CLOSE_BUTTON_ICON); m_close.setPressedIcon(PRESS_CLOSE_BUTTON_ICON); m_close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { InnerFrame.this.close(); } }); m_iconize = new InnerFrameButton(ICONIZE_BUTTON_ICON); m_iconize.setPressedIcon(PRESS_ICONIZE_BUTTON_ICON); m_iconize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { InnerFrame.this.setIconified(!InnerFrame.this.isIconified()); } }); m_buttonWrapperPanel = new JPanel(); m_buttonWrapperPanel.setOpaque(false); m_buttonPanel = new JPanel(new GridLayout(1, 2)); m_buttonPanel.setOpaque(false); m_buttonPanel.add(m_iconize); m_buttonPanel.add(m_close); m_buttonPanel.setAlignmentX(0.5f); m_buttonPanel.setAlignmentY(0.5f); m_buttonWrapperPanel.add(m_buttonPanel); m_iconLabel = new JLabel(); m_iconLabel.setBorder( new EmptyBorder(FRAME_ICON_PADDING, FRAME_ICON_PADDING, FRAME_ICON_PADDING, FRAME_ICON_PADDING)); if (m_frameIcon != null) m_iconLabel.setIcon(m_frameIcon); m_titlePanel.add(m_titleLabel, BorderLayout.CENTER); m_titlePanel.add(m_buttonWrapperPanel, BorderLayout.EAST); m_titlePanel.add(m_iconLabel, BorderLayout.WEST); InnerFrameTitleBarMouseAdapter iftbma = new InnerFrameTitleBarMouseAdapter(this); m_titlePanel.addMouseListener(iftbma); m_titlePanel.addMouseMotionListener(iftbma); }
From source file:edu.ku.brc.af.ui.forms.ViewFactory.java
/** * Creates a panel with the "..." icon.//from w w w. ja v a 2 s .co m * @param comp the component to put into the panel */ public JPanel createIconPanel(final JComponent comp) { JPanel panel = new JPanel(new BorderLayout()); JButton btn = createButton("..."); panel.add(btn, BorderLayout.WEST); panel.add(comp, BorderLayout.EAST); return panel; }
From source file:javanews.gui.internalframe.LinkChart.java
/** * Initialises the class and internal logger. Uses the supplied arguments to * receive data from the application and add data to the charts dynamically. * @param title The title of the charts on display. Whether the displayed * data is for <code>new</code> or <code>old</code> links. * That is whether the data is for newly discovered links or * existing (old) links already stored within the database. * @param parent The instance of <code>COMPortClient</code> that acts as * the data source for the charts. *//*w w w.j ava 2 s . c om*/ public LinkChart(String title, COMPortClient parent) { super("Charts", true, true, true, true); super.setLayer(1); identifier = title.toLowerCase(); // Obtain an instance of Logger for the class log = LoggerFactory.getLogger(className); owner = parent; // Setup a hashtable to hold the values for up, down and unknown link states Hashtable<String, Integer> linkStats = new Hashtable<String, Integer>(); if (identifier.equals("old")) { this.setTitle("Recognised Link Status on " + owner.getPortName() + ":"); // Get the current figures from the link table linkStats = ((LinkTable) owner.getLinkTable().getModel()).getInitialFigures(); } else if (identifier.equals("new")) { this.setTitle("Discovered Link Status on " + owner.getPortName() + ":"); linkStats = ((LinkTable) owner.getNewLinkTable().getModel()).getInitialFigures(); } else { // If the identifier was set to something other than old or new then it's not right. log.warning("An instance of LinkChart has been created for an unknown purpose."); return; } // Initialise the dataset for the pie chart dpdCurrentData = new DefaultPieDataset(); dpdCurrentData.insertValue(0, "Link Down", linkStats.get("down")); dpdCurrentData.insertValue(1, "Link Up", linkStats.get("up")); dpdCurrentData.insertValue(2, "Link State Unknown", linkStats.get("unknown")); // Initialise the dataset for the line chart dcdPreviousData = new DefaultCategoryDataset(); dcdPreviousData.addValue(linkStats.get("down"), "Link Down", Calendar.getInstance().getTime().toString()); dcdPreviousData.addValue(linkStats.get("up"), "Link Up", Calendar.getInstance().getTime().toString()); dcdPreviousData.addValue(linkStats.get("unknown"), "Link State Unknown", Calendar.getInstance().getTime().toString()); // Set the variables we need for holding the charts JFreeChart jfcCurrentStatus; // This will be displayed as a pie chart JFreeChart jfcPreviousStatus; // This will be displayed as a line chart ChartPanel cpCurrent; // Chartpanels hold the JFreeChart ChartPanel cpPrevious; // Use the factory to create the charts jfcCurrentStatus = ChartFactory.createPieChart("Current Status", dpdCurrentData, true, true, false); jfcPreviousStatus = ChartFactory.createLineChart("Previous Status", "Time received", "Number of Links", dcdPreviousData, PlotOrientation.VERTICAL, true, true, false); // Add them to the chart panels cpCurrent = new ChartPanel(jfcCurrentStatus); cpPrevious = new ChartPanel(jfcPreviousStatus); // Add the chart panels to the content pane this.add(cpCurrent, BorderLayout.EAST); this.add(cpPrevious, BorderLayout.WEST); // Change the layout to show them next to each other this.setLayout(new GridLayout(1, 2)); // Add a listener to the window this.addInternalFrameListener(new CloseLinkChart(this)); log.finest("Adding frame to the desktop"); // Set the window properties and display it Client.getJNWindow().addToDesktop(this); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.setSize(650, 400); this.setVisible(true); owner.addChartWindow(title, this); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.links_redundantes.PanelLinkRedundante.java
private void criaInterfaceVisualEscalavel() { miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR); painel = new JPanel(); textAreaSourceCode = new G_TextAreaSourceCode(); //frameSilvinha.setJMenuBar(this.criaMenuBar()); textAreaSourceCode.setTipoHTML();//w ww .ja v a 2s .com textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE)); //frameSilvinha.setTitle(XHTMLPanel.TIT_LINK_RED); painel.setLayout(new GridLayout(2, 1)); setBackground(frameSilvinha.corDefault); Container contentPane = this; contentPane.setLayout(new GridLayout(1, 1)); painel.add(textAreaSourceCode); JPanel panelBtnTabela = new JPanel(); panelBtnTabela.setLayout(new BorderLayout()); /* * Barra de botes */ btnPanel = new JPanel(); btnPanel.setLayout(null); btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR); btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR); btn_salvar.setBounds(10, 0, 150, 25); btnPanel.add(btn_salvar); btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR); btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR); btn_abrir.setBounds(165, 0, 150, 25); btnPanel.add(btn_abrir); btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO); btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO); btn_salvarComo.setBounds(320, 0, 150, 25); btnPanel.add(btn_salvarComo); btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR); btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR); btn_cancelar.setBounds(480, 0, 150, 25); btnPanel.add(btn_cancelar); btnPanel.setPreferredSize(new Dimension(430, 30)); /* * Barra de correcao */ btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR); btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR); btnAplicar.setEnabled(false); texto = new JTextField(); texto.setBorder(BorderFactory.createLineBorder(Color.BLACK)); JPanel borda = new JPanel(new BorderLayout()); JLabel lbl_texto = new JLabel(XHTML_Panel.ROTULO_TEXTO); lbl_texto.setToolTipText(XHTML_Panel.DICA_ROTULO_TEXTO); borda.add(lbl_texto, BorderLayout.WEST); borda.add(texto, BorderLayout.CENTER); borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); borda.setOpaque(false); panelCorretor = new JPanel(new BorderLayout()); panelCorretor.add(borda, BorderLayout.CENTER); panelCorretor.add(btnAplicar, BorderLayout.EAST); //panelCorretor.add(btnPanel,BorderLayout.WEST); panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); panelCorretor.setOpaque(false); /* * Tabela de erros */ tabelaDeErros = new TabelaErros(); scrollPaneTabela = new JScrollPane(); scrollPaneTabela.setViewportView(tabelaDeErros); panelBtnTabela.add(panelCorretor, BorderLayout.NORTH); panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER); panelBtnTabela.add(btnPanel, BorderLayout.SOUTH); scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS)); painel.add(panelBtnTabela); btnPanel.setBackground(frameSilvinha.corDefault); 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()); frameSilvinha.showPainelFerramentaLinksRedundantes(); setVisible(true); } }); //reverter.setActionCommand("Reverter"); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(640, 0, 150, 25); btnPanel.add(reverter); } panelBtnTabela.setBackground(frameSilvinha.corDefault); painel.setBackground(frameSilvinha.corDefault); contentPane.setBackground(frameSilvinha.corDefault); scrollPaneTabela.setBackground(frameSilvinha.corDefault); textAreaSourceCode.setBackground(frameSilvinha.corDefault); miBtnSalvar.setEnabled(false); btn_salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), btn_salvar, miBtnSalvar, frameSilvinha); String fil[] = { ".html", ".htm" }; salvaAlteracoes.setFiltro(fil); contentPane.add(painel); // pack(); this.setVisible(true); }