Example usage for java.awt FlowLayout LEFT

List of usage examples for java.awt FlowLayout LEFT

Introduction

In this page you can find the example usage for java.awt FlowLayout LEFT.

Prototype

int LEFT

To view the source code for java.awt FlowLayout LEFT.

Click Source Link

Document

This value indicates that each row of components should be left-justified.

Usage

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  a  va2 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());

}

From source file:my.honeypotadmin.AppMain.java

public void UserPieSetup(double User, double total) {

    DefaultPieDataset pieDataset = new DefaultPieDataset();
    pieDataset.setValue("User's Usage", User);
    pieDataset.setValue("Remaining Division Usage", total - User);

    JFreeChart chart = ChartFactory.createPieChart3D("User Usage", pieDataset, true, true, true);

    PiePlot P = (PiePlot3D) chart.getPlot();

    ChartPanel panel = new ChartPanel(chart);

    UserPiePanel.removeAll();//from   ww  w .  ja v  a  2 s  . com
    UserPiePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    UserPiePanel.add(panel);
    UserPiePanel.updateUI();

}

From source file:org.kuali.test.ui.components.sqlquerypanel.DatabasePanel.java

@Override
protected void initComponents() {
    super.initComponents();

    JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));

    p.add(new JLabel("Base Table:", JLabel.RIGHT));
    p.add(tableDropdown = new JComboBox());

    p.add(spinner = new Spinner("Loading available database tables..."));

    new SwingWorker() {
        @Override/*from  w  w w . jav a2  s  .  co m*/
        protected Object doInBackground() throws Exception {
            loadAvailableDatabaseTables();
            return null;
        };

        @Override
        protected void done() {
            spinner.stopSpinner();
            tableDropdown.addActionListener(DatabasePanel.this);
        }
    }.execute();

    JPanel p2 = new JPanel(new BorderLayout());
    p2.add(p, BorderLayout.NORTH);

    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Columns",
            new JScrollPane(sqlQueryTree = new SqlQueryTree(getMainframe(), this, getPlatform())));
    tabbedPane.addTab("Select", sqlSelectPanel = new SqlSelectPanel(getMainframe(), this));
    tabbedPane.addTab("Where", sqlWherePanel = new SqlWherePanel(getMainframe(), this));
    tabbedPane.addTab("SQL", sqlDisplayPanel = new SqlDisplayPanel(getMainframe(), this));

    p2.add(tabbedPane, BorderLayout.CENTER);

    add(p2, BorderLayout.CENTER);

    if (!forCheckpoint) {
        getMainframe().getCreateTestButton().setEnabled(false);
        getMainframe().getCreateTestMenuItem().setEnabled(false);
    }
}

From source file:at.tuwien.ifs.somtoolbox.apps.viewer.controls.ClusteringControl.java

public void init() {

    maxCluster = state.growingLayer.getXSize() * state.growingLayer.getYSize();

    spinnerNoCluster = new JSpinner(new SpinnerNumberModel(1, 1, maxCluster, 1));
    spinnerNoCluster.addChangeListener(new ChangeListener() {
        @Override/*from   w  w w . jav a 2s.c o  m*/
        public void stateChanged(ChangeEvent e) {
            numClusters = (Integer) ((JSpinner) e.getSource()).getValue();
            SortedMap<Integer, ClusterElementsStorage> m = mapPane.getMap().getCurrentClusteringTree()
                    .getAllClusteringElements();
            if (m.containsKey(numClusters)) {
                st = m.get(numClusters).sticky;
            } else {
                st = false;
            }
            sticky.setSelected(st);
            redrawClustering();
        }
    });

    JPanel clusterPanel = UiUtils.makeBorderedPanel(new FlowLayout(FlowLayout.LEFT, 10, 0), "Clusters");

    sticky.setToolTipText(
            "Marks this number of clusters as sticky for a certain leve; the next set of clusters will have a smaller boundary");
    sticky.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            st = sticky.isSelected();
            SortedMap<Integer, ClusterElementsStorage> m = mapPane.getMap().getCurrentClusteringTree()
                    .getAllClusteringElements();
            if (m.containsKey(numClusters)) {
                ClusterElementsStorage c = m.get(numClusters);
                c.sticky = st;
                // System.out.println("test");
                // ((ClusterElementsStorageNode)m.get(numClusters)).sticky = st;
                redrawClustering();
            }
        }
    });

    colorCluster = new JCheckBox("colour", state.colorClusters);
    colorCluster.setToolTipText("Fill the clusters in colours");
    colorCluster.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            state.colorClusters = colorCluster.isSelected();
            // TODO: Palette anzeigen (?)
            redrawClustering();
        }
    });

    UiUtils.fillPanel(clusterPanel, new JLabel("#"), spinnerNoCluster, sticky, colorCluster);
    getContentPane().add(clusterPanel, c.nextRow());

    dendogramPanel = UiUtils.makeBorderedPanel(new GridLayout(0, 1), "Dendogram");
    getContentPane().add(dendogramPanel, c.nextRow());

    JPanel numLabelPanel = UiUtils.makeBorderedPanel(new GridBagLayout(), "Labels");
    GridBagConstraintsIFS gcLabels = new GridBagConstraintsIFS();

    labelSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 99, 1));
    labelSpinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            numLabels = (Integer) ((JSpinner) e.getSource()).getValue();
            state.clusterWithLabels = numLabels;
            redrawClustering();
        }
    });

    this.showValues = new JCheckBox("values", state.labelsWithValues);
    this.showValues.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            state.labelsWithValues = showValues.isSelected();
            redrawClustering();
        }
    });

    int start = new Double((1 - state.clusterByValue) * 100).intValue();
    valueQe = new JSlider(0, 100, start);
    valueQe.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            int byValue = ((JSlider) e.getSource()).getValue();
            state.clusterByValue = 1 - byValue / 100;
            redrawClustering();
        }
    });

    numLabelPanel.add(new JLabel("# Labels"), gcLabels);
    numLabelPanel.add(labelSpinner, gcLabels.nextCol());
    numLabelPanel.add(showValues, gcLabels.nextCol());
    numLabelPanel.add(valueQe, gcLabels.nextRow().setGridWidth(3).setFill(GridBagConstraints.HORIZONTAL));
    getContentPane().add(numLabelPanel, c.nextRow());

    Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
    labelTable.put(0, new JLabel("by Value"));
    labelTable.put(100, new JLabel("by Qe"));
    valueQe.setToolTipText("Method how to select representative labels - by QE, or the attribute values");
    valueQe.setLabelTable(labelTable);
    valueQe.setPaintLabels(true);

    final JComboBox initialisationBox = new JComboBox(KMeans.InitType.values());
    initialisationBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Object o = mapPane.getMap().getClusteringTreeBuilder();
            if (o instanceof KMeansTreeBuilder) {
                ((KMeansTreeBuilder) o).reInit((KMeans.InitType) initialisationBox.getSelectedItem());
                // FIXME: is this call needed?
                mapPane.getMap().getCurrentClusteringTree().getAllClusteringElements();
                redrawClustering();
            }
        }
    });

    getContentPane().add(UiUtils.fillPanel(kmeansInitialisationPanel, new JLabel("k-Means initialisation"),
            initialisationBox), c.nextRow());

    JPanel borderPanel = new TitledCollapsiblePanel("Border", new GridLayout(1, 4), true);

    JSpinner borderSpinner = new JSpinner(
            new SpinnerNumberModel(ClusteringTree.INITIAL_BORDER_WIDTH_MAGNIFICATION_FACTOR, 0.1, 5, 0.1));
    borderSpinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            state.clusterBorderWidthMagnificationFactor = ((Double) ((JSpinner) e.getSource()).getValue())
                    .floatValue();
            redrawClustering();
        }
    });

    borderPanel.add(new JLabel("width"));
    borderPanel.add(borderSpinner);

    borderPanel.add(new JLabel("colour"));
    buttonColour = new JButton("");
    buttonColour.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            new ClusterBoderColorChooser(state.parentFrame, state.clusterBorderColour, ClusteringControl.this);
        }
    });
    buttonColour.setBackground(state.clusterBorderColour);
    borderPanel.add(buttonColour);

    getContentPane().add(borderPanel, c.nextRow());

    JPanel evaluationPanel = new TitledCollapsiblePanel("Cluster Evaluation", new GridLayout(3, 2), true);

    evaluationPanel.add(new JLabel("quality measure"));
    qualityMeasureButton = new JButton();
    qualityMeasureButton.setText("ent/pur calc");
    qualityMeasureButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("doing entropy here");
            ClusteringTree clusteringTree = state.mapPNode.getClusteringTree();
            if (clusteringTree == null) {
                // we have not clustered yet
                return;
            }
            // System.out.println(clusteringTree.getChildrenCount());

            // FIXME put this in a method and call it on numcluster.change()
            SOMLibClassInformation classInfo = state.inputDataObjects.getClassInfo();
            ArrayList<ClusterNode> clusters = clusteringTree.getNodesAtLevel(numClusters);
            System.out.println(clusters.size());
            // EntropyMeasure.computeEntropy(clusters, classInfo);
            EntropyAndPurityCalculator eapc = new EntropyAndPurityCalculator(clusters, classInfo);
            // FIXME round first
            entropyLabel.setText(String.valueOf(eapc.getEntropy()));
            purityLabel.setText(String.valueOf(eapc.getPurity()));

        }
    });
    evaluationPanel.add(qualityMeasureButton);
    GridBagConstraintsIFS gcEval = new GridBagConstraintsIFS();

    evaluationPanel.add(new JLabel("entropy"), gcEval);
    evaluationPanel.add(new JLabel("purity"), gcEval.nextCol());

    entropyLabel = new JLabel("n/a");
    purityLabel = new JLabel("n/a");

    evaluationPanel.add(entropyLabel, gcEval.nextRow());
    evaluationPanel.add(purityLabel, gcEval.nextCol());

    getContentPane().add(evaluationPanel, c.nextRow());

    JPanel panelButtons = new JPanel(new GridLayout(1, 4));

    JButton saveButton = new JButton("Save");
    saveButton.setFont(smallFont);
    saveButton.setMargin(SMALL_INSETS);
    saveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser;
            if (state.fileChooser.getSelectedFile() != null) {
                fileChooser = new JFileChooser(state.fileChooser.getSelectedFile().getPath());
            } else {
                fileChooser = new JFileChooser();
            }
            fileChooser.addChoosableFileFilter(clusteringFilter);
            fileChooser.addChoosableFileFilter(xmlFilter);

            File filePath = ExportUtils.getFilePath(ClusteringControl.this, fileChooser,
                    "Save Clustering and Labels");

            if (filePath != null) {
                if (xmlFilter.accept(filePath)) {
                    LabelXmlUtils.saveLabelsToFile(state.mapPNode, filePath);
                } else {
                    try {
                        FileOutputStream fos = new FileOutputStream(filePath);
                        GZIPOutputStream gzipOs = new GZIPOutputStream(fos);
                        PObjectOutputStream oos = new PObjectOutputStream(gzipOs);

                        oos.writeObjectTree(mapPane.getMap().getCurrentClusteringTree());
                        oos.writeObjectTree(mapPane.getMap().getManualLabels());
                        oos.writeInt(state.clusterWithLabels);
                        oos.writeBoolean(state.labelsWithValues);
                        oos.writeDouble(state.clusterByValue);
                        oos.writeObject(spinnerNoCluster.getValue());

                        oos.close();
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
                // keep the selected path for future references
                state.fileChooser.setSelectedFile(filePath.getParentFile());
            }
        }
    });
    panelButtons.add(saveButton);

    JButton loadButton = new JButton("Load");
    loadButton.setFont(smallFont);
    loadButton.setMargin(SMALL_INSETS);
    loadButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = getFileChooser();
            fileChooser.setName("Open Clustering");
            fileChooser.addChoosableFileFilter(xmlFilter);
            fileChooser.addChoosableFileFilter(clusteringFilter);

            int returnVal = fileChooser.showDialog(ClusteringControl.this, "Open");
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File filePath = fileChooser.getSelectedFile();
                if (xmlFilter.accept(filePath)) {
                    PNode restoredLabels = null;
                    try {
                        restoredLabels = LabelXmlUtils.restoreLabelsFromFile(fileChooser.getSelectedFile());
                        PNode manual = state.mapPNode.getManualLabels();

                        ArrayList<PNode> tmp = new ArrayList<PNode>();
                        for (ListIterator<?> iter = restoredLabels.getChildrenIterator(); iter.hasNext();) {
                            PNode element = (PNode) iter.next();
                            tmp.add(element);
                        }
                        manual.addChildren(tmp);
                        Logger.getLogger("at.tuwien.ifs.somtoolbox")
                                .info("Successfully loaded cluster labels.");
                    } catch (Exception e1) {
                        e1.printStackTrace();
                        Logger.getLogger("at.tuwien.ifs.somtoolbox")
                                .info("Error loading cluster labels: " + e1.getMessage());
                    }

                } else {

                    try {
                        FileInputStream fis = new FileInputStream(filePath);
                        GZIPInputStream gzipIs = new GZIPInputStream(fis);
                        ObjectInputStream ois = new ObjectInputStream(gzipIs);
                        ClusteringTree tree = (ClusteringTree) ois.readObject();

                        PNode manual = (PNode) ois.readObject();
                        PNode all = mapPane.getMap().getManualLabels();
                        ArrayList<PNode> tmp = new ArrayList<PNode>();
                        for (ListIterator<?> iter = manual.getChildrenIterator(); iter.hasNext();) {
                            PNode element = (PNode) iter.next();
                            tmp.add(element);
                        }
                        all.addChildren(tmp);

                        state.clusterWithLabels = ois.readInt();
                        labelSpinner.setValue(state.clusterWithLabels);
                        state.labelsWithValues = ois.readBoolean();
                        showValues.setSelected(state.labelsWithValues);
                        state.clusterByValue = ois.readDouble();
                        valueQe.setValue(new Double((1 - state.clusterByValue) * 100).intValue());

                        mapPane.getMap().buildTree(tree);
                        spinnerNoCluster.setValue(ois.readObject());

                        ois.close();
                        Logger.getLogger("at.tuwien.ifs.somtoolbox").info("Successfully loaded clustering.");
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        Logger.getLogger("at.tuwien.ifs.somtoolbox")
                                .info("Error loading clustering: " + ex.getMessage());
                    }

                }
                // keep the selected path for future references
                state.fileChooser.setSelectedFile(filePath.getParentFile());
            }
        }

    });
    panelButtons.add(loadButton);

    JButton exportImages = new JButton("Export");
    exportImages.setFont(smallFont);
    exportImages.setMargin(SMALL_INSETS);
    exportImages.setToolTipText("Export labels as images (not yet working)");
    exportImages.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = new JFileChooser();
            if (CommonSOMViewerStateData.fileNamePrefix != null
                    && !CommonSOMViewerStateData.fileNamePrefix.equals("")) {
                fileChooser.setCurrentDirectory(new File(CommonSOMViewerStateData.fileNamePrefix));
            } else {
                fileChooser.setCurrentDirectory(state.getFileChooser().getCurrentDirectory());
            }
            fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            if (fileChooser.getSelectedFile() != null) { // reusing the dialog
                fileChooser.setSelectedFile(null);
            }
            fileChooser.setName("Choose path");
            int returnVal = fileChooser.showDialog(ClusteringControl.this, "Choose path");
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                // save images
                String path = fileChooser.getSelectedFile().getAbsolutePath();
                Logger.getLogger("at.tuwien.ifs.somtoolbox").info("Writing label images to " + path);
            }
        }
    });
    panelButtons.add(exportImages);

    JButton deleteManual = new JButton("Delete");
    deleteManual.setFont(smallFont);
    deleteManual.setMargin(SMALL_INSETS);
    deleteManual.setToolTipText("Delete manually added labels.");
    deleteManual.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            state.mapPNode.getManualLabels().removeAllChildren();
            Logger.getLogger("at.tuwien.ifs.somtoolbox").info("Manual Labels deleted.");
        }
    });
    panelButtons.add(deleteManual);
    c.anchor = GridBagConstraints.NORTH;
    this.getContentPane().add(panelButtons, c.nextRow());

    this.setVisible(true);
}

From source file:org.executequery.gui.scriptgenerators.GenerateScriptsPanelThree.java

private void createTableOptionsPanel() {

    constraintsCheck = new JCheckBox("Include constraints");
    consAsAlterCheck = new JCheckBox("As ALTER TABLE statements", true);
    consInCreateCheck = new JCheckBox("Within CREATE TABLE statements");

    constraintsCheck.addItemListener(this);

    ButtonGroup bg = new ButtonGroup();
    bg.add(consAsAlterCheck);//w w  w .  ja  v a  2 s .  c  om
    bg.add(consInCreateCheck);

    consInCreateCheck.setEnabled(false);
    consAsAlterCheck.setEnabled(false);

    createTableOptionsPanel = new ComponentTitledPanel(constraintsCheck);
    JPanel _panel = createTableOptionsPanel.getContentPane();
    _panel.setLayout(new FlowLayout(FlowLayout.LEFT, 15, 5));
    _panel.add(consAsAlterCheck);
    _panel.add(consInCreateCheck);
}

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptComponent.java

/**
 * Returns the component hosted.//from  w w  w . j  a  va  2s .c om
 * 
 * @return See above.
 */
private JComponent getComponent() {
    JPanel p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    p.add(component);
    if (unitLabel != null)
        p.add(unitLabel);
    return p;
}

From source file:es.emergya.ui.plugins.AdminPanel.java

public AdminPanel(String t, Icon icon, Option myself, boolean canCreateNew, boolean canDelete) {
    super();/*from  w ww  .j av a2s . c o m*/
    setCanCreateNew(canCreateNew);
    setCanDelete(canDelete);
    setLayout(new SpringLayout());
    this.father = myself;
    setBackground(Color.WHITE);

    // Titulo con icono
    JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    title = new JLabel(t);
    title.setIcon(icon);
    title.setFont(LogicConstants.deriveBoldFont(12f));
    title.setBorder(new EmptyBorder(0, 10, 0, 10));
    titlePanel.add(title);
    titlePanel.setOpaque(false);
    add(titlePanel);
    Dimension d = titlePanel.getSize();
    if (icon != null)
        d.height = icon.getIconHeight();
    titlePanel.setMaximumSize(d);

    // Controles de "nuevo" "seleccionar todos" etc...
    JPanel controls = new JPanel(new FlowLayout(FlowLayout.LEADING));
    controls.setOpaque(false);
    final boolean femenino = t.indexOf("atrulla") != -1 || t.indexOf("apa") != -1 || t.indexOf("lota") != -1
            || t.indexOf("encia") != -1;

    if (getCanCreateNew()) {
        if (femenino) {
            newButton = new JButton("Nueva", getIcon("button_nuevo"));
        } else {
            newButton = new JButton("Nuevo", getIcon("button_nuevo"));
        }
        controls.add(newButton);
    }
    if (getCanDelete()) {
        JButton selectAll = new JButton(((femenino) ? "Seleccionar Todas" : "Seleccionar Todos"),
                getIcon("button_selectall"));
        selectAll.addActionListener(this);
        controls.add(selectAll);
        deselectAll = new JButton(((femenino) ? "Deseleccionar Todas" : "Deseleccionar Todos"),
                getIcon("button_unselectall"));
        deselectAll.addActionListener(this);
        controls.add(deselectAll);
        JButton deleteAll = new JButton(((femenino) ? "Eliminar Seleccionadas" : "Eliminar Seleccionados"),
                getIcon("button_delall"));
        deleteAll.addActionListener(this);
        controls.add(deleteAll);
    }
    d = controls.getSize();
    controls.setMaximumSize(d);
    add(controls);

    // Tabla
    tablePanel = new JPanel(new BorderLayout());
    tablePanel.setOpaque(false);
    add(tablePanel);

    SpringUtilities.makeCompactGrid(this, 3, 1, 0, 0, 0, 0);
}

From source file:org.richie.codeGen.ui.CodeGenMainUI.java

public JPanel getWestPanel() {
    if (westPanel == null) {
        westPanel = new JPanel();
        westPanel.setLayout(new BorderLayout());
        JLabel filterLable = new JLabel("");
        JPanel filterPanel = new JPanel();
        filterPanel.add(filterLable);/*from w ww. ja  v a 2  s .  c o m*/
        filterField = new JTextField(15);
        Document doc = filterField.getDocument();
        doc.addDocumentListener(new TextDocumentListener());
        filterPanel.add(filterField);
        filterPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
        westPanel.setPreferredSize(new Dimension(200, 650));// ?,JPanel
        westPanel.add(filterPanel, BorderLayout.NORTH);
        westPanel.add(getTreepanel(), BorderLayout.CENTER);
    }
    return westPanel;
}

From source file:org.kuali.test.ui.components.panels.WebServicePanel.java

/**
 *
 *//*ww w  .j av  a2 s  . com*/
@Override
protected void handleStartTest() {
    final WebService ws = Utils.findWebServiceByName(getMainframe().getConfiguration(),
            getPlatform().getWebServiceName());

    if (ws != null) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("web service: " + ws.getName());
            LOG.debug("wsdl: " + ws.getWsdlUrl());
        }

        TablePanel tp = new TablePanel(inputParameters = createInputParametersTable());

        String[] labels = { "Web Service Operations", "Return Type", "Expected Result", "On Failure", "" };

        returnType = new JLabel("           ");
        expectedResult = new JTextField(20);
        expectedResult.setEnabled(false);
        failureAction = new JComboBox(Utils.getXmlEnumerations(FailureAction.class));
        failureAction.setEnabled(false);

        poll = new JCheckBox("Poll web service");
        poll.setSelected(getMainframe().getConfiguration().getDefaultWebServicePolling());

        JComponent[] components = { operations = new JComboBox(), returnType, expectedResult, failureAction,
                poll };

        operations.addActionListener(this);

        JPanel p = new JPanel(new BorderLayout());
        JPanel p2 = new JPanel(new FlowLayout(FlowLayout.LEFT, 1, 1));
        p2.add(UIUtils.buildEntryPanel(labels, components));
        p.add(p2, BorderLayout.NORTH);
        p.add(new JSeparator(), BorderLayout.SOUTH);
        tp.add(p, BorderLayout.NORTH);
        add(tp, BorderLayout.CENTER);

        new SplashDisplay(getMainframe(), "Loading WSDL", "Loading web service definition...") {
            @Override
            protected void runProcess() {
                try {
                    ServiceClient wsClient = new ServiceClient(null, new URL(ws.getWsdlUrl()), null, null);
                    Options options = wsClient.getOptions();

                    if (StringUtils.isNotBlank(ws.getUsername())) {
                        options.setUserName(ws.getUsername());
                        options.setPassword(
                                Utils.decrypt(getMainframe().getEncryptionPassword(), ws.getPassword()));
                    }

                    Iterator<AxisOperation> it = wsClient.getAxisService().getOperations();

                    List<OperationWrapper> l = new ArrayList<OperationWrapper>();
                    while (it.hasNext()) {
                        l.add(new OperationWrapper(it.next()));
                    }

                    Collections.sort(l);

                    l.add(0, new OperationWrapper(null));

                    for (OperationWrapper ow : l) {
                        operations.addItem(ow);
                        if (LOG.isDebugEnabled()) {
                            if (ow.getOperation() != null) {
                                LOG.debug("operation: " + ow.getOperation().getName());
                            }
                        }
                    }

                    if (LOG.isDebugEnabled()) {
                        ByteArrayOutputStream bos = new ByteArrayOutputStream();
                        wsClient.getAxisService().printSchema(bos);
                        LOG.debug(new String(bos.toByteArray()));
                    }

                    xmlSchema = wsClient.getAxisService().getSchema(0);
                }

                catch (Exception ex) {
                    UIUtils.showError(getMainframe(), "Web Service Error",
                            "Error coccurred while attempting to connect to web service - " + ex.toString());
                    LOG.error(ex.toString(), ex);
                }
            }
        };
    }
}

From source file:org.apache.hadoopts.app.bucketanalyser.TSOperationControlerPanel.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//www .  j  ava  2  s  . c  o m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jTextField1 = new javax.swing.JTextField();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jTextField2 = new javax.swing.JTextField();
    jButton15 = new javax.swing.JButton();
    jButton11 = new javax.swing.JButton();
    jRadioButton1 = new javax.swing.JRadioButton();
    jPanel2 = new javax.swing.JPanel();
    jTextField3 = new javax.swing.JTextField();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    jButton18 = new javax.swing.JButton();
    jButton12 = new javax.swing.JButton();
    jButton13 = new javax.swing.JButton();
    jButton22 = new javax.swing.JButton();
    jButton9 = new javax.swing.JButton();
    jButton8 = new javax.swing.JButton();
    jButton7 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jPanel4 = new javax.swing.JPanel();
    jtMIN = new javax.swing.JTextField();
    jtMAX = new javax.swing.JTextField();
    jtBINS = new javax.swing.JTextField();
    jButton10 = new javax.swing.JButton();
    jButton20 = new javax.swing.JButton();
    jButton21 = new javax.swing.JButton();
    jButton19 = new javax.swing.JButton();
    jPanel6 = new javax.swing.JPanel();
    jButton14 = new javax.swing.JButton();
    jButton4 = new javax.swing.JButton();
    jButton5 = new javax.swing.JButton();
    jButton6 = new javax.swing.JButton();
    jPanel7 = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    jButton16 = new javax.swing.JButton();
    jPanel8 = new javax.swing.JPanel();
    jButton17 = new javax.swing.JButton();
    jButton23 = new javax.swing.JButton();
    jButton24 = new javax.swing.JButton();
    jButton25 = new javax.swing.JButton();
    jButton26 = new javax.swing.JButton();
    jButton27 = new javax.swing.JButton();

    jTextField1.setText("jTextField1");

    setBackground(new java.awt.Color(204, 204, 255));
    setBounds(new java.awt.Rectangle(0, 0, 800, 150));
    setMinimumSize(new java.awt.Dimension(308, 150));
    setPreferredSize(new java.awt.Dimension(800, 150));
    setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));

    jPanel1.setBackground(new java.awt.Color(204, 204, 255));
    jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 1, 1));

    jTextField2.setBackground(new java.awt.Color(204, 255, 204));
    jTextField2.setColumns(45);
    jTextField2.setText("ChartLabel");
    jPanel1.add(jTextField2);

    jButton15.setText("persist TSB");
    jButton15.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton15ActionPerformed(evt);
        }
    });
    jPanel1.add(jButton15);

    jButton11.setText("hide");
    jButton11.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton11ActionPerformed(evt);
        }
    });
    jPanel1.add(jButton11);

    jRadioButton1.setText("show labels");
    jPanel1.add(jRadioButton1);

    jTabbedPane1.addTab("TSB", jPanel1);

    jPanel2.setBackground(new java.awt.Color(204, 204, 255));
    jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 1, 1));

    jTextField3.setColumns(45);
    jTextField3.setText("/GITHUB/dissertation/main/FINAL/LATEX/semanpix/");
    jTextField3.setMinimumSize(new java.awt.Dimension(40, 28));
    jTextField3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField3ActionPerformed(evt);
        }
    });
    jPanel2.add(jTextField3);

    jButton1.setBackground(new java.awt.Color(204, 204, 255));
    jButton1.setText("save PN");
    jButton1.setToolTipText("Save series in an Origin-Project.");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });
    jPanel2.add(jButton1);

    jButton2.setText("show PN");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
        }
    });
    jPanel2.add(jButton2);

    jTabbedPane1.addTab("Pix-Node", jPanel2);

    jPanel3.setBackground(new java.awt.Color(255, 255, 204));
    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Single Time Series Transformations"));
    jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 1));

    jButton18.setText("Shuffle");
    jButton18.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton18ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton18);

    jButton12.setText("NORM max=1");
    jButton12.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton12ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton12);

    jButton13.setText("NORM std=1, avg=0");
    jButton13.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton13ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton13);

    jButton22.setText("Log");
    jButton22.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton22ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton22);

    jButton9.setText("Returns (Rel-Diff)");
    jButton9.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton9ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton9);

    jButton8.setText("Diffs");
    jButton8.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton8ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton8);

    jButton7.setText("Profile");
    jButton7.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton7ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton7);

    jButton3.setText("FFT");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton3ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton3);

    jTabbedPane1.addTab("Transformations", jPanel3);

    jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Univariate Analysis"));
    jPanel4.setPreferredSize(new java.awt.Dimension(1225, 113));

    jtMIN.setText("-10");
    jPanel4.add(jtMIN);

    jtMAX.setText("10");
    jPanel4.add(jtMAX);

    jtBINS.setText("50");
    jPanel4.add(jtBINS);

    jButton10.setText("Histogram per series");
    jButton10.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton10ActionPerformed(evt);
        }
    });
    jPanel4.add(jButton10);

    jButton20.setText("Histogram cross-cut");
    jButton20.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton20ActionPerformed(evt);
        }
    });
    jPanel4.add(jButton20);

    jButton21.setText("TEST Normal Distribution");
    jButton21.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton21ActionPerformed(evt);
        }
    });
    jPanel4.add(jButton21);

    jButton19.setText("CDF");
    jButton19.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton19ActionPerformed(evt);
        }
    });
    jPanel4.add(jButton19);

    jButton14.setText("ENTROPY");
    jButton14.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton14ActionPerformed(evt);
        }
    });
    jPanel6.add(jButton14);

    jButton4.setText("Auto-Correlation");
    jButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton4ActionPerformed(evt);
        }
    });
    jPanel6.add(jButton4);

    jButton5.setText("DFA");
    jButton5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton5ActionPerformed(evt);
        }
    });
    jPanel6.add(jButton5);

    jButton6.setText("MF-DFA");
    jButton6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton6ActionPerformed(evt);
        }
    });
    jPanel6.add(jButton6);

    jPanel4.add(jPanel6);

    jTabbedPane1.addTab("Uni-variate. Analysis", jPanel4);

    jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Multi-variate analysis"));
    jTabbedPane1.addTab("Multi-variate Analysis", jPanel7);

    jPanel5.setBackground(new java.awt.Color(255, 204, 204));
    jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Group Operations"));

    jButton16.setText("Sigma Band");
    jButton16.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton16ActionPerformed(evt);
        }
    });
    jPanel5.add(jButton16);

    jTabbedPane1.addTab("Group Operations", jPanel5);

    jPanel8.setBackground(new java.awt.Color(204, 255, 204));
    jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Models"));

    jButton17.setText("AR");
    jPanel8.add(jButton17);

    jButton23.setText("MA");
    jPanel8.add(jButton23);

    jButton24.setText("ARMA");
    jPanel8.add(jButton24);

    jButton25.setText("ARIMA");
    jPanel8.add(jButton25);

    jButton26.setText("SARIMA");
    jPanel8.add(jButton26);

    jButton27.setText("CARIMA");
    jPanel8.add(jButton27);

    jTabbedPane1.addTab("TS-Model", jPanel8);

    add(jTabbedPane1);
}