List of usage examples for java.awt FlowLayout FlowLayout
public FlowLayout(int align)
From source file:net.chaosserver.timelord.swingui.CommonTaskPanel.java
/** * Builds the search panel at the top of the page. * * @return the search panel//from www . j av a 2 s. c om */ protected JPanel buildSearchPanel() { JPanel searchPanel = new JPanel(); searchPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); searchTextField = new JTextField(); searchTextField.setColumns(50); searchTextField.setActionCommand(ACTION_SEARCHTEXT); searchTextField.addActionListener(this); searchPanel.add(searchTextField); return searchPanel; }
From source file:net.aepik.alasca.gui.util.LoadFileFrame.java
/** * Initialize frame content.// www. j a v a2 s. c om */ private void initFrame() { // - Panel bouton du bas - JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); boutonsPanel.add(boutonOk); boutonsPanel.add(boutonAnnuler); // - Panel nom du fichier - JTextArea textAreaFilename = new JTextArea( "Indiquez le nom du fichier contenant les dfinitions du schma LDAP que vous souhaitez charger."); textAreaFilename.setEditable(false); textAreaFilename.setLineWrap(true); textAreaFilename.setWrapStyleWord(true); textAreaFilename.setFont((new JLabel()).getFont()); textAreaFilename.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6)); textAreaFilename.setBackground(new Color(240, 235, 226)); boutonOpenFile.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0, 5, 0, 0, boutonsPanel.getBackground()), boutonOpenFile.getBorder())); JPanel filenamePanel = new JPanel(new BorderLayout()); filenamePanel.add(textAreaFilename, BorderLayout.NORTH); filenamePanel.add(filename, BorderLayout.CENTER); filenamePanel.add(boutonOpenFile, BorderLayout.EAST); filenamePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4), BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Schma LDAP "), BorderFactory.createEmptyBorder(0, 5, 5, 5)))); // - Panel du selecteur de syntaxes - JTextArea textAreaSyntaxes = new JTextArea( "Il vous faut appliquer un filtre sur le schma que vous voulez charger. Voici la liste des filtres disponibles :"); textAreaSyntaxes.setEditable(false); textAreaSyntaxes.setLineWrap(true); textAreaSyntaxes.setWrapStyleWord(true); textAreaSyntaxes.setFont((new JLabel()).getFont()); textAreaSyntaxes.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6)); textAreaSyntaxes.setBackground(new Color(240, 235, 226)); JPanel syntaxesPanel = new JPanel(new BorderLayout()); syntaxesPanel.add(textAreaSyntaxes, BorderLayout.NORTH); syntaxesPanel.add(syntaxes); syntaxesPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4), BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Syntaxe LDAP "), BorderFactory.createEmptyBorder(0, 5, 5, 5)))); // On injecte le nom des classes de syntaxes possibles // dynamiquement. String[] syntaxesName = Schema.getSyntaxeNames(); for (int i = 0; syntaxesName != null && i < syntaxesName.length; i++) { syntaxes.addItem(syntaxesName[i]); } // - Organisation gnrale - JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(filenamePanel, BorderLayout.NORTH); mainPanel.add(syntaxesPanel, BorderLayout.CENTER); JPanel mainPanelContainer = new JPanel(new BorderLayout()); mainPanelContainer.add(mainPanel, BorderLayout.NORTH); mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH); mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1)); getContentPane().add(new DescriptiveInternalFrame(mainFrame.getIconImage(), "Slectionner un fichier et sa syntaxe.", mainPanelContainer)); // - Listeners - addWindowListener(this); boutonOpenFile.addActionListener(this); boutonOk.addActionListener(this); boutonAnnuler.addActionListener(this); }
From source file:org.nees.rpi.vis.ui.ProfilePlotFrame.java
private void initChartArea() { JFreeChart chart;// w w w.j ava2 s .c om xyDataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart(null, "Sensor Reading", "Sensor Depth", xyDataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.WHITE); XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setAutoRange(false); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setShapesFilled(true); chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); chartPanel.setHorizontalAxisTrace(true); chartPanel.setVerticalAxisTrace(true); chartPanel.setOpaque(false); VisSaveJChartPlotToImageButton saveButton = new VisSaveJChartPlotToImageButton(this, chart); JPanel buttonArea = new JPanel(); buttonArea.setOpaque(false); buttonArea.setLayout(new FlowLayout(FlowLayout.LEFT)); buttonArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 3)); buttonArea.add(saveButton); JPanel chartArea = new JPanel(); chartArea.setOpaque(false); chartArea.setLayout(new BorderLayout()); chartArea.add(chartPanel, BorderLayout.CENTER); chartArea.add(buttonArea, BorderLayout.NORTH); contentPane.add(chartArea, BorderLayout.CENTER); }
From source file:com.floreantpos.config.ui.DatabaseConfigurationView.java
protected void initUI() { setLayout(new BorderLayout()); JPanel contentPanel = new JPanel(); contentPanel.setLayout(new MigLayout("fill", "[][grow,fill]", "[][][][][][][][grow,fill]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ tfServerAddress = new POSTextField(); tfServerPort = new POSTextField(); tfDatabaseName = new POSTextField(); tfUserName = new POSTextField(); tfPassword = new POSPasswordField(); databaseCombo = new JComboBox(Database.values()); String databaseProviderName = AppConfig.getDatabaseProviderName(); if (StringUtils.isNotEmpty(databaseProviderName)) { databaseCombo.setSelectedItem(Database.getByProviderName(databaseProviderName)); }//w w w .j av a 2 s . c o m contentPanel.add(new JLabel(Messages.getString("DatabaseConfigurationDialog.8"))); //$NON-NLS-1$ contentPanel.add(databaseCombo, "grow, wrap"); //$NON-NLS-1$ lblServerAddress = new JLabel(Messages.getString("DatabaseConfigurationDialog.10") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ contentPanel.add(lblServerAddress); contentPanel.add(tfServerAddress, "grow, wrap"); //$NON-NLS-1$ lblServerPort = new JLabel(Messages.getString("DatabaseConfigurationDialog.13") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ contentPanel.add(lblServerPort); contentPanel.add(tfServerPort, "grow, wrap"); //$NON-NLS-1$ lblDbName = new JLabel(Messages.getString("DatabaseConfigurationDialog.16") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ contentPanel.add(lblDbName); contentPanel.add(tfDatabaseName, "grow, wrap"); //$NON-NLS-1$ lblUserName = new JLabel(Messages.getString("DatabaseConfigurationDialog.19") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ contentPanel.add(lblUserName); contentPanel.add(tfUserName, "grow, wrap"); //$NON-NLS-1$ lblDbPassword = new JLabel(Messages.getString("DatabaseConfigurationDialog.22") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ contentPanel.add(lblDbPassword); contentPanel.add(tfPassword, "grow, wrap"); //$NON-NLS-1$ contentPanel.add(new JSeparator(), "span, grow, gaptop 10"); //$NON-NLS-1$ btnTestConnection = new JButton(Messages.getString("DatabaseConfigurationDialog.26")); //$NON-NLS-1$ btnTestConnection.setActionCommand(TEST); btnSave = new JButton(Messages.getString("DatabaseConfigurationDialog.27")); //$NON-NLS-1$ btnSave.setActionCommand(SAVE); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); btnCreateDb = new JButton(Messages.getString("DatabaseConfigurationDialog.29")); //$NON-NLS-1$ btnCreateDb.setActionCommand(CONFIGURE_DB); buttonPanel.add(btnCreateDb); buttonPanel.add(btnTestConnection); buttonPanel.add(btnSave); contentPanel.add(buttonPanel, "span, grow"); //$NON-NLS-1$ JScrollPane scrollPane = new JScrollPane(contentPanel); scrollPane.setBorder(null); add(scrollPane); }
From source file:edu.harvard.mcz.imagecapture.TemplatePickerDialog.java
protected void init(ICImage image) { setBounds(100, 100, 450, 300);// w ww .java 2 s . c o m StringBuffer title = new StringBuffer(); title.append("Change Template"); if (image != null) { title.append(" for ").append(image.getFilename()); } this.setTitle(title.toString()); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { lblTemplate = new JLabel("Template"); lblTemplate.setHorizontalAlignment(SwingConstants.CENTER); contentPanel.add(lblTemplate, BorderLayout.NORTH); } { comboBoxTemplatePicker = new JComboBox<String>(); comboBoxTemplatePicker.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub PositionTemplate defaultTemplate; try { defaultTemplate = new PositionTemplate((String) comboBoxTemplatePicker.getSelectedItem()); File fileToCheck = new File(ImageCaptureProperties .assemblePathWithBase(imageToTemplate.getPath(), imageToTemplate.getFilename())); BufferedImage imagefile = ImageIO.read(fileToCheck); int x = defaultTemplate.getBarcodeULPosition().width; int y = defaultTemplate.getBarcodeULPosition().height; int w = defaultTemplate.getBarcodeSize().width; int h = defaultTemplate.getBarcodeSize().height; setBarcodeImage(imagefile.getSubimage(x, y, w, h)); } catch (NullPointerException e1) { log.error(e1.getMessage()); } catch (NoSuchTemplateException e1) { log.error(e1.getMessage()); } catch (IOException e1) { log.error(e1.getMessage()); } } }); contentPanel.add(comboBoxTemplatePicker, BorderLayout.SOUTH); } { JPanel panel = new JPanel(); contentPanel.add(panel, BorderLayout.CENTER); panel.setLayout(new BorderLayout(0, 0)); { lblFileName = new JLabel("FileName"); panel.add(lblFileName, BorderLayout.NORTH); } { labelBarcodeImage = new JLabel("Catalog Number Barcode"); labelBarcodeImage.setIcon(new ImageIcon(TemplatePickerDialog.class .getResource("/edu/harvard/mcz/imagecapture/resources/gnome-mime-image.png"))); panel.add(labelBarcodeImage, BorderLayout.CENTER); } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.setActionCommand("OK"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub ICImageLifeCycle ils = new ICImageLifeCycle(); try { String newTemplateID = (String) comboBoxTemplatePicker.getSelectedItem(); if (newTemplateID != null) { imageToTemplate.setTemplateId(newTemplateID); ils.attachDirty(imageToTemplate); setVisible(false); } } catch (SaveFailedException e1) { log.error(e1.getMessage(), e1); } } }); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); buttonPane.add(cancelButton); } } if (image != null) { try { boolean result = setupForImage(image); } catch (UnreadableFileException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:es.emergya.ui.gis.popups.RouteDialog.java
private RouteDialog() { super();/* ww w . jav a 2s . c om*/ setAlwaysOnTop(true); setResizable(false); iconTransparente = LogicConstants.getIcon("48x48_transparente"); iconEnviando = LogicConstants.getIcon("anim_calculando"); try { route = new OsmDataLayer(new DataSet(), "route", File.createTempFile("route", "route")); } catch (IOException e) { log.error(e.getMessage(), e); } setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { clear.doClick(); setVisible(false); } }); setTitle(i18n.getString("window.route.titleBar")); setMinimumSize(new Dimension(400, 200)); try { setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getIconImage()); } catch (Throwable e) { LOG.error("There is no icon image", e); } JPanel base = new JPanel(); base.setBackground(Color.WHITE); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); // Icono del titulo JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING)); title.setOpaque(false); final JLabel labelTitle = new JLabel(i18n.getString("window.route.title"), LogicConstants.getIcon("tittleventana_icon_calcularruta"), JLabel.LEFT); labelTitle.setFont(LogicConstants.deriveBoldFont(12.0f)); title.add(labelTitle); base.add(title); JPanel content = new JPanel(new SpringLayout()); content.setOpaque(false); // Coordenadas content.add(new JLabel(i18n.getString("window.route.origen"), JLabel.LEFT)); JPanel coords = new JPanel(new GridLayout(1, 2)); coords.setOpaque(false); fx = new JTextField(8); fx.setEditable(false); fy = new JTextField(8); fy.setEditable(false); coords.add(fy); coords.add(fx); content.add(coords); content.add(new JLabel(i18n.getString("window.route.destino"), JLabel.LEFT)); JPanel coords2 = new JPanel(new GridLayout(1, 2)); coords2.setOpaque(false); tx = new JTextField(8); tx.setEditable(false); ty = new JTextField(8); ty.setEditable(false); coords2.add(ty); coords2.add(tx); content.add(coords2); SpringUtilities.makeCompactGrid(content, 2, 2, 6, 6, 6, 6); base.add(content); // Area para mensajes JPanel notificationArea = new JPanel(); notificationArea.setOpaque(false); notification = new JLabel("PLACEHOLDER"); notification.setForeground(Color.WHITE); notificationArea.add(notification); base.add(notificationArea); JPanel buttons = new JPanel(); buttons.setOpaque(false); buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS)); search = new JButton(i18n.getString("window.route.calcular"), LogicConstants.getIcon("ventanacontextual_button_calcularruta")); search.addActionListener(this); buttons.add(search); clear = new JButton(i18n.getString("window.route.limpiar"), LogicConstants.getIcon("button_limpiar")); clear.addActionListener(this); buttons.add(clear); buttons.add(Box.createHorizontalGlue()); progressIcon = new JLabel(iconTransparente); buttons.add(progressIcon); buttons.add(Box.createHorizontalGlue()); JButton cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel")); cancel.addActionListener(this); buttons.add(cancel); base.add(buttons); getContentPane().add(base); pack(); int x; int y; Container myParent; try { myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getContentPane(); java.awt.Point topLeft = myParent.getLocationOnScreen(); Dimension parentSize = myParent.getSize(); Dimension mySize = getSize(); if (parentSize.width > mySize.width) x = ((parentSize.width - mySize.width) / 2) + topLeft.x; else x = topLeft.x; if (parentSize.height > mySize.height) y = ((parentSize.height - mySize.height) / 2) + topLeft.y; else y = topLeft.y; setLocation(x, y); } catch (Throwable e1) { LOG.error("There is no basic window!", e1); } }
From source file:captureplugin.drivers.defaultdriver.AdditionalParams.java
/** * Create List-Panel// ww w. j a v a 2 s .c o m * @return List-Panel */ private Component createListPanel() { JPanel panel = new JPanel(new BorderLayout(0, 2)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); panel.add(new JLabel(mLocalizer.msg("command", "Command")), BorderLayout.NORTH); mList = new JList(mListModel); panel.add(new JScrollPane(mList), BorderLayout.CENTER); JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT)); JButton add = new JButton(TVBrowserIcons.newIcon(TVBrowserIcons.SIZE_SMALL)); add.setToolTipText(Localizer.getLocalization(Localizer.I18N_ADD)); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addPressed(); } }); buttons.add(add); JButton remove = new JButton(TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL)); remove.setToolTipText(Localizer.getLocalization(Localizer.I18N_DELETE)); remove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removePressed(); } }); buttons.add(remove); final JButton up = new JButton(TVBrowserIcons.up(TVBrowserIcons.SIZE_SMALL)); up.setToolTipText(Localizer.getLocalization(Localizer.I18N_UP)); buttons.add(up); up.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { upPressed(); } }); final JButton down = new JButton(TVBrowserIcons.down(TVBrowserIcons.SIZE_SMALL)); down.setToolTipText(Localizer.getLocalization(Localizer.I18N_DOWN)); buttons.add(down); down.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { downPressed(); } }); mStartStop = new JButton(mStartIcon); mStartStop.setToolTipText(mLocalizer.msg("startstop", "Activate or Deactivate Parameter")); mStartStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startStopPressed(); } }); buttons.add(mStartStop); panel.add(buttons, BorderLayout.SOUTH); mList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { selectionChanged(); if (mList.getSelectedIndex() == 0) { up.setEnabled(false); down.setEnabled(true); } else if (mList.getSelectedIndex() == mListModel.getSize() - 1) { up.setEnabled(true); down.setEnabled(false); } else { up.setEnabled(true); down.setEnabled(true); } } }); selectionChanged(); return panel; }
From source file:com.emental.mindraider.ui.dialogs.OpenConceptByTagJDialog.java
public OpenConceptByTagJDialog(String dialogTitle, String selectionLabel, String buttonLabel, boolean showCancel) { super(dialogTitle); JPanel framePanel = new JPanel(); framePanel.setBorder(new EmptyBorder(5, 10, 0, 10)); framePanel.setLayout(new BorderLayout()); // NORTH panel JPanel northPanel = new JPanel(); northPanel.setLayout(new BorderLayout()); northPanel.add(new JLabel(selectionLabel), BorderLayout.NORTH); final JTextField tagLabel = new JTextField(TEXTFIELD_WIDTH); // data/*w ww . j ava 2 s . c o m*/ tags = MindRaider.tagCustodian.getAllTags(); ; if (tags == null) { tagLabel.setEnabled(false); } tagLabel.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) { logger.debug("Openning selected tag..."); openTagSearchDialog(); } } public void keyReleased(KeyEvent keyEvent) { getListModel().clear(); shownTags.clear(); if (tagLabel.getText().length() > 0) { for (TagEntry tag : tags) { if (tag.getTagLabel().toLowerCase().startsWith(tagLabel.getText().toLowerCase())) { getListModel().addElement(tag.getTagLabel() + " (" + tag.getCardinality() + ")"); shownTags.add(tag); } } } else { // show all tags for (TagEntry tag : tags) { getListModel().addElement(tag.getTagLabel() + " (" + tag.getCardinality() + ")"); shownTags.add(tag); } } } public void keyTyped(KeyEvent keyEvent) { } }); northPanel.add(tagLabel, BorderLayout.SOUTH); framePanel.add(northPanel, BorderLayout.NORTH); // CENTER panel JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BorderLayout()); centerPanel.add(new JLabel(Messages.getString("OpenConceptByTagJDialog.matchingTags")), BorderLayout.NORTH); defaultListModel = new DefaultListModel(); list = new JList(defaultListModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); // list.addListSelectionListener(this); list.setVisibleRowCount(15); JScrollPane listScrollPane = new JScrollPane(list); centerPanel.add(listScrollPane, BorderLayout.SOUTH); framePanel.add(centerPanel, BorderLayout.CENTER); JPanel southPanel = new JPanel(); southPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); JButton openButton = new JButton(buttonLabel); southPanel.add(openButton); openButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openTagSearchDialog(); } }); if (showCancel) { JButton cancelButton = new JButton(Messages.getString("OpenNotebookJDialog.cancel")); southPanel.add(cancelButton); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OpenConceptByTagJDialog.this.dispose(); } }); } framePanel.add(southPanel, BorderLayout.SOUTH); getContentPane().add(framePanel, BorderLayout.CENTER); // show pack(); Gfx.centerAndShowWindow(this); }
From source file:GCWrapper.java
/** * Creates and lays out components in the container. See the comments below * for an organizational overview by panel. *///from ww w . j a v a 2 s . com private void initComponents(Container c) { // +=c=====================================================+ // ++=gcPanel==============================================+ // ++ [gcSelection] + // ++=capsPanel============================================+ // +++=imageCapsPanel======================================+ // +++ [imageAccelerated] + // +++ [imageTrueVolatile] + // +++=bufferCapsPanel=====================================+ // ++++=bufferAccessCapsPanel==============================+ // +++++=flippingPanel=====================================+ // +++++ [flipping] + // +++++=fsPanel===========================================+ // +++++ [indentPanel][fullScreen] + // +++++=mbPanel===========================================+ // +++++ [indentPanel][multiBuffer] + // ++++=buffersPanel=======================================+ // +++++=fbPanel===============+=bbPanel===================+ // +++++ + + // +++++ [fbAccelerated] + [bbAccelerated] + // +++++ + + // +++++ [fbTrueVolatile] + [bbTrueVolatile] + // +++++ + + // +=======================================================+ c.setLayout(new BorderLayout()); // Graphics Config JPanel gcPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(gcPanel, BorderLayout.NORTH); gcSelection.setPreferredSize(new Dimension(400, 30)); gcPanel.add(gcSelection); // Capabilities JPanel capsPanel = new JPanel(new BorderLayout()); c.add(capsPanel, BorderLayout.CENTER); // Image Capabilities JPanel imageCapsPanel = new JPanel(new GridLayout(2, 1)); capsPanel.add(imageCapsPanel, BorderLayout.NORTH); imageCapsPanel.setBorder(BorderFactory.createTitledBorder("Image Capabilities")); imageAccelerated.setEnabled(false); imageCapsPanel.add(imageAccelerated); imageTrueVolatile.setEnabled(false); imageCapsPanel.add(imageTrueVolatile); // Buffer Capabilities JPanel bufferCapsPanel = new JPanel(new BorderLayout()); capsPanel.add(bufferCapsPanel, BorderLayout.CENTER); bufferCapsPanel.setBorder(BorderFactory.createTitledBorder("Buffer Capabilities")); // Buffer Access JPanel bufferAccessCapsPanel = new JPanel(new GridLayout(3, 1)); bufferAccessCapsPanel.setPreferredSize(new Dimension(300, 88)); bufferCapsPanel.add(bufferAccessCapsPanel, BorderLayout.NORTH); // Flipping JPanel flippingPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(flippingPanel); flippingPanel.add(flipping); flipping.setEnabled(false); flippingPanel.add(flippingMethod); // Full-screen JPanel fsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(fsPanel); JPanel indentPanel = new JPanel(); indentPanel.setPreferredSize(new Dimension(30, 30)); fsPanel.add(indentPanel); fsPanel.add(fullScreen); fullScreen.setEnabled(false); // Multi-buffering JPanel mbPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(mbPanel); indentPanel = new JPanel(); indentPanel.setPreferredSize(new Dimension(30, 30)); mbPanel.add(indentPanel); mbPanel.add(multiBuffer); multiBuffer.setEnabled(false); // Front and Back Buffer Capabilities JPanel buffersPanel = new JPanel(new GridLayout(1, 2)); bufferCapsPanel.add(buffersPanel, BorderLayout.CENTER); // Front Buffer JPanel fbPanel = new JPanel(new GridLayout(2, 1)); fbPanel.setBorder(BorderFactory.createTitledBorder("Front Buffer")); buffersPanel.add(fbPanel); fbPanel.add(fbAccelerated); fbAccelerated.setEnabled(false); fbPanel.add(fbTrueVolatile); fbTrueVolatile.setEnabled(false); // Back Buffer JPanel bbPanel = new JPanel(new GridLayout(2, 1)); bbPanel.setPreferredSize(new Dimension(250, 80)); bbPanel.setBorder(BorderFactory.createTitledBorder("Back and Intermediate Buffers")); buffersPanel.add(bbPanel); bbPanel.add(bbAccelerated); bbAccelerated.setEnabled(false); bbPanel.add(bbTrueVolatile); bbTrueVolatile.setEnabled(false); }
From source file:net.pandoragames.far.ui.swing.RenameFilesPanel.java
private void init(SwingConfig config, ComponentRepository componentRepository) { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder( BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING)); this.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING))); JLabel patternLabel = new JLabel(localizer.localize("label.find-pattern")); this.add(patternLabel); filenamePattern = new JTextField(); filenamePattern.setPreferredSize(//from w ww.j av a2 s. c o m new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, config.getStandardComponentHight())); filenamePattern .setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, config.getStandardComponentHight())); filenamePattern.setAlignmentX(Component.LEFT_ALIGNMENT); UndoHistory findUndoManager = new UndoHistory(); findUndoManager.registerUndoHistory(filenamePattern); findUndoManager.registerSnapshotHistory(filenamePattern); componentRepository.getReplaceCommand().addResetable(findUndoManager); filenamePattern.getDocument().addDocumentListener(new DocumentChangeListener() { public void documentUpdated(DocumentEvent e, String text) { dataModel.setPatternString(text); updateFileTable(); } }); componentRepository.getResetDispatcher().addToBeCleared(filenamePattern); this.add(filenamePattern); JCheckBox caseBox = new JCheckBox(localizer.localize("label.ignore-case")); caseBox.setSelected(true); caseBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { dataModel.setIgnoreCase((ItemEvent.SELECTED == event.getStateChange())); updateFileTable(); } }); this.add(caseBox); JCheckBox regexBox = new JCheckBox(localizer.localize("label.regular-expression")); regexBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { dataModel.setRegexPattern((ItemEvent.SELECTED == event.getStateChange())); updateFileTable(); } }); this.add(regexBox); JPanel extensionPanel = new JPanel(); extensionPanel.setBorder(BorderFactory.createTitledBorder(localizer.localize("label.modify-extension"))); extensionPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); extensionPanel.setAlignmentX(Component.LEFT_ALIGNMENT); extensionPanel.setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, 60)); extensionPanel.setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, 100)); ButtonGroup extensionGroup = new ButtonGroup(); JRadioButton protectButton = new JRadioButton(localizer.localize("label.protect-extension")); protectButton.setSelected(true); protectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dataModel.setProtectExtension(true); updateFileTable(); } }); extensionGroup.add(protectButton); extensionPanel.add(protectButton); JRadioButton includeButton = new JRadioButton(localizer.localize("label.include-extension")); includeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dataModel.setExtensionOnly(false); dataModel.setProtectExtension(false); updateFileTable(); } }); extensionGroup.add(includeButton); extensionPanel.add(includeButton); JRadioButton onlyButton = new JRadioButton(localizer.localize("label.only-extension")); onlyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dataModel.setExtensionOnly(true); updateFileTable(); } }); extensionGroup.add(onlyButton); extensionPanel.add(onlyButton); this.add(extensionPanel); this.add(Box.createVerticalGlue()); this.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING))); // replace JLabel replaceLabel = new JLabel(localizer.localize("label.replacement-pattern")); this.add(replaceLabel); replacePattern = new JTextField(); replacePattern.setPreferredSize( new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, config.getStandardComponentHight())); replacePattern .setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, config.getStandardComponentHight())); replacePattern.setAlignmentX(Component.LEFT_ALIGNMENT); UndoHistory undoManager = new UndoHistory(); undoManager.registerUndoHistory(replacePattern); undoManager.registerSnapshotHistory(replacePattern); componentRepository.getReplaceCommand().addResetable(undoManager); replacePattern.getDocument().addDocumentListener(new DocumentChangeListener() { public void documentUpdated(DocumentEvent e, String text) { dataModel.setReplacementString(text); updateFileTable(); } }); componentRepository.getResetDispatcher().addToBeCleared(replacePattern); this.add(replacePattern); // treat case JPanel modifyCasePanel = new JPanel(); modifyCasePanel.setBorder(BorderFactory.createTitledBorder(localizer.localize("label.modify-case"))); modifyCasePanel.setLayout(new BoxLayout(modifyCasePanel, BoxLayout.Y_AXIS)); modifyCasePanel.setAlignmentX(Component.LEFT_ALIGNMENT); modifyCasePanel.setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, 100)); modifyCasePanel.setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, 200)); ButtonGroup modifyCaseGroup = new ButtonGroup(); ActionListener radioButtonListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); dataModel.setTreatCase(RenameForm.CASEHANDLING.valueOf(cmd)); updateFileTable(); } }; JRadioButton lowerButton = new JRadioButton(localizer.localize("label.to-lower-case")); lowerButton.setActionCommand(RenameForm.CASEHANDLING.LOWER.name()); lowerButton.addActionListener(radioButtonListener); modifyCaseGroup.add(lowerButton); modifyCasePanel.add(lowerButton); JRadioButton upperButton = new JRadioButton(localizer.localize("label.to-upper-case")); upperButton.setActionCommand(RenameForm.CASEHANDLING.UPPER.name()); upperButton.addActionListener(radioButtonListener); modifyCaseGroup.add(upperButton); modifyCasePanel.add(upperButton); JRadioButton keepButton = new JRadioButton(localizer.localize("label.preserve-case")); keepButton.setActionCommand(RenameForm.CASEHANDLING.PRESERVE.name()); keepButton.setSelected(true); keepButton.addActionListener(radioButtonListener); modifyCaseGroup.add(keepButton); modifyCasePanel.add(keepButton); this.add(modifyCasePanel); // prevent case conflict JCheckBox caseConflictBox = new JCheckBox(localizer.localize("label.prevent-case-conflict")); caseConflictBox.setAlignmentX(Component.LEFT_ALIGNMENT); caseConflictBox.setSelected(true); caseConflictBox.setEnabled(!SwingConfig.isWindows()); // disabled on windows caseConflictBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { dataModel.setPreventCaseConflict((ItemEvent.SELECTED == event.getStateChange())); updateFileTable(); } }); this.add(caseConflictBox); this.add(Box.createVerticalGlue()); }