Example usage for java.awt BorderLayout WEST

List of usage examples for java.awt BorderLayout WEST

Introduction

In this page you can find the example usage for java.awt BorderLayout WEST.

Prototype

String WEST

To view the source code for java.awt BorderLayout WEST.

Click Source Link

Document

The west layout constraint (left side of container).

Usage

From source file:fsart.diffTools.gui.DiffToolsMainPanel.java

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it by your code!
 *
 * @noinspection ALL/*  w  ww .  ja v  a 2  s  .  c o  m*/
 */
private void $$$setupUI$$$() {
    panel1 = new JPanel();
    panel1.setLayout(new BorderLayout(0, 0));
    final Spacer spacer1 = new Spacer();
    panel1.add(spacer1, BorderLayout.WEST);
    final Spacer spacer2 = new Spacer();
    panel1.add(spacer2, BorderLayout.EAST);
    final Spacer spacer3 = new Spacer();
    panel1.add(spacer3, BorderLayout.SOUTH);
    final Spacer spacer4 = new Spacer();
    panel1.add(spacer4, BorderLayout.NORTH);
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new FormLayout(
            "left:max(d;4px):noGrow,left:4dlu:noGrow,center:max(d;50px):grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:5dlu:noGrow,fill:max(d;4px):noGrow",
            "top:d:grow,top:4dlu:noGrow,top:d:noGrow,top:4dlu:noGrow,center:max(d;25px):noGrow,top:6dlu:noGrow,top:max(d;4px):noGrow,top:4dlu:noGrow,top:max(d;25px):noGrow,top:7dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,bottom:d:grow"));
    panel2.putClientProperty("html.disable", Boolean.FALSE);
    panel1.add(panel2, BorderLayout.CENTER);
    final Spacer spacer5 = new Spacer();
    CellConstraints cc = new CellConstraints();
    panel2.add(spacer5, cc.xy(3, 1, CellConstraints.DEFAULT, CellConstraints.FILL));
    browseButton = new JButton();
    browseButton.setText("Browse");
    panel2.add(browseButton, cc.xy(5, 5));
    comparedFileLabel = new JLabel();
    comparedFileLabel.setText("Compared file :");
    panel2.add(comparedFileLabel, cc.xy(3, 7, CellConstraints.LEFT, CellConstraints.TOP));
    browseButton1 = new JButton();
    browseButton1.setText("Browse");
    panel2.add(browseButton1, cc.xy(5, 9, CellConstraints.DEFAULT, CellConstraints.TOP));
    final Spacer spacer6 = new Spacer();
    panel2.add(spacer6, cc.xy(3, 13, CellConstraints.DEFAULT, CellConstraints.FILL));
    final Spacer spacer7 = new Spacer();
    panel2.add(spacer7, cc.xy(1, 9, CellConstraints.FILL, CellConstraints.DEFAULT));
    final Spacer spacer8 = new Spacer();
    panel2.add(spacer8, cc.xy(7, 7, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new FormLayout("fill:d:grow", "center:d:grow"));
    panel2.add(panel3, cc.xyw(3, 11, 3, CellConstraints.FILL, CellConstraints.FILL));
    compareButton = new JButton();
    compareButton.setPreferredSize(new Dimension(100, 29));
    compareButton.setText("Compare");
    panel3.add(compareButton, cc.xy(1, 1, CellConstraints.CENTER, CellConstraints.CENTER));
    baseFileLabel = new JLabel();
    baseFileLabel.setText("Base file :");
    panel2.add(baseFileLabel, cc.xy(3, 3, CellConstraints.FILL, CellConstraints.FILL));
    baseFileTxt = new JTextField();
    baseFileTxt.setMinimumSize(new Dimension(50, 27));
    baseFileTxt.setPreferredSize(new Dimension(50, 27));
    panel2.add(baseFileTxt, cc.xy(3, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    comparedFileTxt = new JTextField();
    comparedFileTxt.setMinimumSize(new Dimension(50, 27));
    comparedFileTxt.setPreferredSize(new Dimension(100, 27));
    panel2.add(comparedFileTxt, cc.xy(3, 9, CellConstraints.FILL, CellConstraints.DEFAULT));
    outputField = new JTextField();
    outputField.setMinimumSize(new Dimension(50, 27));
    outputField.setPreferredSize(new Dimension(100, 27));
    panel2.add(outputField, cc.xy(3, 15, CellConstraints.FILL, CellConstraints.DEFAULT));
}

From source file:net.sf.jabref.EntryEditor.java

/**
 * Create toolbar for entry editor.//  w  ww  .  j  ava 2s  .  c  om
 */
private void setupToolBar() {
    JToolBar tlb = new JToolBar(JToolBar.VERTICAL);
    CloseAction closeAction = new CloseAction();
    ;
    StoreFieldAction storeFieldAction = new StoreFieldAction();
    DeleteAction deleteAction = new DeleteAction();
    UndoAction undoAction = new UndoAction();
    RedoAction redoAction = new RedoAction();

    tlb.setBorder(null);
    tlb.setRollover(true);
    tlb.setMargin(new Insets(0, 0, 0, 2));
    tlb.setFloatable(false);
    tlb.addSeparator();
    tlb.add(deleteAction);
    tlb.addSeparator();
    tlb.add(prevEntryAction);
    tlb.add(nextEntryAction);
    tlb.addSeparator();
    tlb.add(helpAction);
    for (Component comp : tlb.getComponents()) {
        ((JComponent) comp).setOpaque(false);
    }

    // The toolbar carries all the key bindings that are valid for the whole window.
    ActionMap am = tlb.getActionMap();
    InputMap im = tlb.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.put(prefs.getKey("Close entry editor"), "close");
    am.put("close", closeAction);
    im.put(prefs.getKey("Entry editor, store field"), "store");
    am.put("store", storeFieldAction);
    im.put(prefs.getKey("Entry editor, previous entry"), "prev");
    am.put("prev", prevEntryAction);
    im.put(prefs.getKey("Entry editor, next entry"), "next");
    am.put("next", nextEntryAction);
    im.put(prefs.getKey("Undo"), "undo");
    am.put("undo", undoAction);
    im.put(prefs.getKey("Redo"), "redo");
    am.put("redo", redoAction);
    im.put(prefs.getKey("Help"), "help");
    am.put("help", helpAction);

    // Add actions (and thus buttons)
    JButton closeBut = new JButton(closeAction);
    closeBut.setText(null);
    closeBut.setBorder(null);

    // Create type-label
    TypeLabel typeLabel = new TypeLabel(entry.getType().getName());

    JPanel leftPan = new JPanel();
    leftPan.setLayout(new BorderLayout());
    leftPan.add(closeBut, BorderLayout.NORTH);
    leftPan.add(typeLabel, BorderLayout.CENTER);
    leftPan.add(tlb, BorderLayout.SOUTH);

    add(leftPan, BorderLayout.WEST);
}

From source file:org.pmedv.blackboard.board.BoardDesignerPerspective.java

@Override
protected void initializeComponents() {
    setLayout(new BorderLayout());
    toolTabPane = new JTabbedPane(JTabbedPane.BOTTOM);
    horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

    ctx = AppContext.getContext();//from   ww  w.j  a  va  2 s. com
    resources = ctx.getBean(ResourceService.class);
    advisor = ctx.getBean(ApplicationWindowAdvisor.class);

    final String position = (String) Preferences.values
            .get("org.pmedv.blackboard.BoardDesignerPerspective.layerPanelPlacement");

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {

            viewMap = new ViewMap();

            rootWindow = DockingUtil.createRootWindow(viewMap, true);
            rootWindow.getWindowBar(Direction.DOWN).setEnabled(true);
            rootWindow.getWindowProperties().setMinimizeEnabled(true);

            DockingWindowsTheme theme = new SoftBlueIceDockingTheme();

            rootWindow.getRootWindowProperties().addSuperObject(theme.getRootWindowProperties());
            rootWindow.getWindowProperties().getTabProperties().getHighlightedButtonProperties()
                    .getCloseButtonProperties().setVisible(false);
            rootWindow.getWindowProperties().getTabProperties().getNormalButtonProperties()
                    .getCloseButtonProperties().setVisible(false);

            editorArea = new TabWindow();
            editorArea.getWindowProperties().getTabProperties().getNormalButtonProperties()
                    .getCloseButtonProperties().setVisible(false);
            editorArea.getWindowProperties().getTabProperties().getHighlightedButtonProperties()
                    .getCloseButtonProperties().setVisible(false);
            editorArea.getWindowProperties().getTabProperties().getNormalButtonProperties()
                    .getMinimizeButtonProperties().setVisible(true);
            editorArea.getWindowProperties().getTabProperties().getHighlightedButtonProperties()
                    .getMinimizeButtonProperties().setVisible(true);

            DockingWindowAdapter dockingAdapter = new DockingWindowAdapter() {
                @Override
                public void windowClosing(DockingWindow window) throws OperationAbortedException {

                }
            };

            editorArea.addListener(dockingAdapter);
            setDockingListener(dockingAdapter);

            rootWindow.setWindow(editorArea);

            if (position.equalsIgnoreCase("left")) {
                horizontalSplitPane.setRightComponent(rootWindow);
            } else {
                horizontalSplitPane.setLeftComponent(rootWindow);
            }

            advisor.setCurrentEditorArea(editorArea);

        }

    });

    JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer();
    taskpanecontainer.setBackground(new Color(182, 191, 205));

    JXTaskPane shapePane = new JXTaskPane();
    shapePane.setTitle(resources.getResourceByKey("BoardDesignerPerspective.shapes.title"));
    shapePane.add(ctx.getBean(ShapePropertiesPanel.class));
    taskpanecontainer.add(shapePane);

    ctx.getBean(ShapePropertiesPanel.class).getStartLineCombo().setSelectedItem(LineEdgeType.STRAIGHT);
    ctx.getBean(ShapePropertiesPanel.class).getEndLineCombo().setSelectedItem(LineEdgeType.STRAIGHT);
    ctx.getBean(ShapePropertiesPanel.class).getThicknessCombo().setSelectedItem(new BasicStroke(2.0f));

    JXTaskPane layerPane = new JXTaskPane();
    layerPane.setTitle(resources.getResourceByKey("BoardDesignerPerspective.layers"));
    layerPane.add(ctx.getBean(ShowLayersCommand.class).getLayerPanel());
    taskpanecontainer.add(layerPane);

    JScrollPane scrollPane = new JScrollPane(taskpanecontainer);

    if (position.equalsIgnoreCase("left")) {
        horizontalSplitPane.setLeftComponent(toolTabPane);
    } else {
        horizontalSplitPane.setRightComponent(toolTabPane);
    }

    horizontalSplitPane.setOneTouchExpandable(true);
    horizontalSplitPane.setDividerSize(10);

    toolTabPane.addTab(resources.getResourceByKey("tooltab.forms"), resources.getIcon("icon.paint"),
            scrollPane);

    final SymbolListPanel symbolListPanel = ctx.getBean(SymbolListPanel.class);
    toolTabPane.addTab(resources.getResourceByKey("tooltab.symbols"), resources.getIcon("icon.symbols"),
            symbolListPanel);

    final ModelListPanel modelListPanel = ctx.getBean(ModelListPanel.class);
    toolTabPane.addTab(resources.getResourceByKey("tooltab.models"), resources.getIcon("icon.model"),
            modelListPanel);

    add(horizontalSplitPane, BorderLayout.CENTER);

    commandArea = new RSyntaxTextArea();
    commandArea.setRows(1);
    commandArea.setColumns(100);

    JPanel commandPanel = new JPanel(new BorderLayout());
    commandPanel.add(new JLabel("Command :"), BorderLayout.WEST);
    commandPanel.add(commandArea, BorderLayout.CENTER);
    commandArea.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2),
            BorderFactory.createLineBorder(Color.BLACK)));
    add(commandPanel, BorderLayout.NORTH);
    setupAutoComplete();

    commandArea.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {

            if (e.getKeyCode() == KeyEvent.VK_ENTER) {

                if (commandArea.getText().startsWith("add ") && commandArea.getText().length() > 4
                        && commandArea.hasFocus()) {

                    PartFactory pf = AppContext.getContext().getBean(PartFactory.class);

                    String tokens[] = commandArea.getText().split(" ");
                    StringBuffer partName = new StringBuffer();

                    for (int i = 1; i < tokens.length; i++) {
                        partName.append(tokens[i] + " ");
                    }

                    String name = partName.toString().trim();

                    if (pf.getPartnames().contains(name)) {
                        e.consume();
                        commandArea.setText("");
                        BoardUtil.addPart(name, EditorUtils.getCurrentActiveEditor());
                    }

                } else if (commandArea.getText().equals("new")) {
                    e.consume();
                    commandArea.setText("");
                    AppContext.getContext().getBean(CreateBoardCommand.class).execute(null);
                } else if (commandArea.getText().equals("resistor")) {
                    e.consume();
                    commandArea.setText("");
                    AppContext.getContext().getBean(AddResistorCommand.class).execute(null);
                } else if (commandArea.getText().equals("diode")) {
                    e.consume();
                    commandArea.setText("");
                    AppContext.getContext().getBean(AddDiodeCommand.class).execute(null);
                } else if (commandArea.getText().equals("text")) {
                    e.consume();
                    commandArea.setText("");
                    AppContext.getContext().getBean(AddTextCommand.class).execute(null);
                } else if (commandArea.getText().equals("open")) {
                    e.consume();
                    commandArea.setText("");
                    new OpenBoardCommand().execute(null);
                } else if (commandArea.getText().equals("save")) {
                    e.consume();
                    commandArea.setText("");
                    AppContext.getContext().getBean(SaveBoardCommand.class).execute(null);
                } else if (commandArea.getText().equals("color")) {
                    e.consume();
                    commandArea.setText("");
                    AppContext.getContext().getBean(ChooseColorCommand.class).execute(null);
                }

            }

        }

    });

    horizontalSplitPane.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equalsIgnoreCase("dividerLocation")) {
                configProvider.getConfig().setDividerLocation(horizontalSplitPane.getDividerLocation());
            }
        }
    });

    ctx.getBean(ShapePropertiesPanel.class).getObjectField()
            .setText(resources.getResourceByKey("ShapePropertiesPanel.items.none"));
    ctx.getBean(ShapePropertiesPanel.class).getRotationSpinner().setEnabled(false);
    ctx.getBean(ShapePropertiesPanel.class).getStartAngleSpinner().setEnabled(false);

    initListeners();

}

From source file:org.cloudml.ui.graph.Visu.java

public void createFrame() {
    final VisualizationViewer<Vertex, Edge> vv = v.getVisualisationViewer();

    vv.getRenderContext().setVertexIconTransformer(new Transformer<Vertex, Icon>() {
        public Icon transform(final Vertex v) {
            return new Icon() {

                public int getIconHeight() {
                    return 40;
                }/*from  w  ww  . j  a  v a  2  s .co m*/

                public int getIconWidth() {
                    return 40;
                }

                public void paintIcon(java.awt.Component c, Graphics g, int x, int y) {
                    ImageIcon img;
                    if (v.getType() == "node") {
                        img = new ImageIcon(this.getClass().getResource("/server.png"));
                    } else if (v.getType() == "platform") {
                        img = new ImageIcon(this.getClass().getResource("/dbms.png"));
                    } else {
                        img = new ImageIcon(this.getClass().getResource("/soft.png"));
                    }
                    ImageObserver io = new ImageObserver() {

                        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width,
                                int height) {
                            // TODO Auto-generated method stub
                            return false;
                        }
                    };
                    g.drawImage(img.getImage(), x, y, getIconHeight(), getIconWidth(), io);

                    if (!vv.getPickedVertexState().isPicked(v)) {
                        g.setColor(Color.black);
                    } else {
                        g.setColor(Color.red);

                        properties.setModel(new CPIMTable(v));
                        runtimeProperties.setModel(new CPSMTable(v));
                    }
                    g.drawString(v.getName(), x - 10, y + 50);
                }
            };
        }
    });

    // create a frame to hold the graph
    final JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel, BorderLayout.CENTER);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(gm);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton save = new JButton("save");
    save.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            int returnVal = fc.showDialog(frame, "save");
            File result = fc.getSelectedFile();
            JsonCodec codec = new JsonCodec();
            OutputStream streamResult;
            try {
                streamResult = new FileOutputStream(result);
                codec.save(dmodel, streamResult);
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    });
    JButton saveImage = new JButton("save as image");
    saveImage.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            int returnVal = fc.showDialog(frame, "save");
            File result = fc.getSelectedFile();
            JsonCodec codec = new JsonCodec();
            v.writeJPEGImage(result);
        }
    });
    //WE NEED TO UPDATE THE FACADE AND THE GUI
    JButton load = new JButton("load");
    load.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            int returnVal = fc.showDialog(frame, "load");
            File result = fc.getSelectedFile();
            JsonCodec codec = new JsonCodec();
            try {
                InputStream stream = new FileInputStream(result);
                Deployment model = (Deployment) codec.load(stream);
                dmodel = model;
                v.setDeploymentModel(dmodel);
                ArrayList<Vertex> V = v.drawFromDeploymentModel();
                nodeTypes.removeAll();
                nodeTypes.setModel(fillList());

                properties.setModel(new CPIMTable(V.get(0)));
                runtimeProperties.setModel(new CPSMTable(V.get(0)));

                CommandFactory fcommand = new CommandFactory();
                CloudMlCommand load = fcommand.loadDeployment(result.getPath());
                cml.fireAndWait(load);

            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });
    JButton deploy = new JButton("Deploy!");
    deploy.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //cad.deploy(dmodel);
            System.out.println("deploy");
            CommandFactory fcommand = new CommandFactory();
            CloudMlCommand deploy = fcommand.deploy();
            cml.fireAndWait(deploy);
        }
    });

    //right panel
    JPanel intermediary = new JPanel();
    intermediary.setLayout(new BoxLayout(intermediary, BoxLayout.PAGE_AXIS));
    intermediary.setBorder(BorderFactory.createLineBorder(Color.black));

    JLabel jlCPIM = new JLabel();
    jlCPIM.setText("CPIM");

    JLabel jlCPSM = new JLabel();
    jlCPSM.setText("CPSM");

    properties = new JTable(null);
    //properties.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    JTableHeader h = properties.getTableHeader();
    JPanel props = new JPanel();
    props.setLayout(new BorderLayout());
    props.add(new JScrollPane(properties), BorderLayout.CENTER);
    props.add(h, BorderLayout.NORTH);

    runtimeProperties = new JTable(null);
    //runtimeProperties.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    JTableHeader h2 = runtimeProperties.getTableHeader();
    JPanel runProps = new JPanel();
    runProps.setLayout(new BorderLayout());
    runProps.add(h2, BorderLayout.NORTH);
    runProps.add(new JScrollPane(runtimeProperties), BorderLayout.CENTER);

    intermediary.add(jlCPIM);
    intermediary.add(props);
    intermediary.add(jlCPSM);
    intermediary.add(runProps);

    content.add(intermediary, BorderLayout.EAST);

    //Left panel
    JPanel selection = new JPanel();
    JLabel nodes = new JLabel();
    nodes.setText("Types");
    selection.setLayout(new BoxLayout(selection, BoxLayout.PAGE_AXIS));
    nodeTypes = new JList(fillList());
    nodeTypes.setLayoutOrientation(JList.VERTICAL);
    nodeTypes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    nodeTypes.setVisibleRowCount(10);
    JScrollPane types = new JScrollPane(nodeTypes);
    types.setPreferredSize(new Dimension(150, 80));
    selection.add(nodes);
    selection.add(types);

    content.add(selection, BorderLayout.WEST);

    ((DefaultModalGraphMouse<Integer, Number>) gm)
            .add(new MyEditingGraphMousePlugin(0, vv, v.getGraph(), nodeTypes, dmodel));
    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    controls.add(save);
    controls.add(saveImage);
    controls.add(load);
    controls.add(deploy);
    controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox());
    content.add(controls, BorderLayout.SOUTH);

    frame.pack();
    frame.setVisible(true);
}

From source file:kg.apc.jmeter.vizualizers.SynthesisReportGui.java

/**
 * Main visualizer setup./*from   w  ww  . ja v a 2  s.c  o m*/
 */
private void init() {
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();
    Border margin = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    mainPanel.add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE));

    // SortFilterModel mySortedModel =
    // new SortFilterModel(myStatTableModel);
    JTable myJTable = new JTable(model);
    myJTable.getTableHeader().setDefaultRenderer(new JMeterHeaderAsPropertyRenderer(COLUMNS_MSG_PARAMETERS));
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
    RendererUtils.applyRenderers(myJTable, RENDERERS);
    JScrollPane myScrollPane = new JScrollPane(myJTable);
    this.add(mainPanel, BorderLayout.NORTH);
    this.add(myScrollPane, BorderLayout.CENTER);
    saveTable.addActionListener(this);
    JPanel opts = new JPanel();
    opts.add(useGroupName, BorderLayout.WEST);
    opts.add(saveTable, BorderLayout.CENTER);
    opts.add(saveHeaders, BorderLayout.EAST);
    this.add(opts, BorderLayout.SOUTH);
}

From source file:com.opendoorlogistics.studio.appframe.AppFrame.java

private void initToolbar(ActionFactory actionBuilder, List<? extends Action> fileActions,
        List<? extends Action> editActions) {
    getContentPane().add(mainToolbar, BorderLayout.WEST);

    mainToolbar.setFloatable(false);//from  w ww .ja  v a2 s .  c  o m

    mainToolbar.removeAll();
    for (Action action : fileActions) {
        if (action != null && action.getValue(Action.LARGE_ICON_KEY) != null) {
            mainToolbar.add(action);
        }
    }
    for (Action action : editActions) {
        if (action != null && action.getValue(Action.LARGE_ICON_KEY) != null) {
            mainToolbar.add(action);
        }
    }

    Action helpsite = actionBuilder.createGotoWebsiteAction(this);
    if (helpsite != null) {
        mainToolbar.add(helpsite);
    }

    mainToolbar.revalidate();
    mainToolbar.repaint();
}

From source file:org.ut.biolab.medsavant.client.view.variants.BrowserPage.java

@Override
public JPanel getView() {
    try {//w  w w .  j av  a2  s.c  o m
        if (view == null) {
            trackAdditionLock.acquire();
            view = new JPanel();
            view.setLayout(new BorderLayout());
            view.add(new WaitPanel("Starting Genome Browser"));

            Chromosome[] chroms = MedSavantClient.ReferenceManager.getChromosomes(
                    LoginController.getSessionID(), ReferenceController.getInstance().getCurrentReferenceID());
            genomeContainer = new GenomeContainer(pageName, chroms);
            genomeView = new PeekingPanel("Genome", BorderLayout.SOUTH, genomeContainer, false, 225);

            final JPanel variationPlaceHolder = new JPanel();
            variationPlaceHolder.setLayout(new BorderLayout());
            variationPlaceHolder.add(new WaitPanel("Initializing variant views..."), BorderLayout.CENTER);
            variationPanel = new PeekingPanel("Variations", BorderLayout.WEST, variationPlaceHolder, false,
                    325);
            variationPanel.setToggleBarVisible(false);

            Runnable prepareBrowserThread = new Runnable() {
                @Override
                public void run() {
                    try {
                        final JPanel tmpView = new JPanel();
                        tmpView.setLayout(new BorderLayout());

                        genomeView.setToggleBarVisible(false);

                        tmpView.add(genomeView, BorderLayout.NORTH);

                        browserPanel = new JPanel();
                        browserPanel.setLayout(new BorderLayout());

                        Savant savantInstance = Savant.getInstance(false, false);
                        setupToolbarButtons(savantInstance);

                        PersistentSettings.getInstance().setColor(ColourKey.GRAPH_PANE_BACKGROUND_BOTTOM,
                                Color.white);
                        PersistentSettings.getInstance().setColor(ColourKey.GRAPH_PANE_BACKGROUND_TOP,
                                Color.white);
                        PersistentSettings.getInstance().setColor(ColourKey.AXIS_GRID,
                                new Color(240, 240, 240));

                        savantInstance.setStartPageVisible(false);
                        savantInstance.setTrackBackground(new Color(210, 210, 210));
                        savantInstance.setBookmarksVisibile(false);
                        savantInstance.setVariantsVisibile(false);

                        variationPlaceHolder.removeAll();
                        variationPlaceHolder.add(VariationController.getInstance().getModule(),
                                BorderLayout.CENTER);

                        GenomeController.getInstance().setGenome(null);

                        String referenceName = ReferenceController.getInstance().getCurrentReferenceName();
                        final String urlOfTrack = getTrackURL(referenceName, "sequence");

                        browserPanel.add(savantInstance.getBrowserPanel(), BorderLayout.CENTER);

                        tmpView.add(browserPanel, BorderLayout.CENTER);
                        tmpView.add(variationPanel, BorderLayout.EAST);

                        SwingUtilities.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                view.removeAll();
                                view.add(tmpView, BorderLayout.CENTER);
                                view.updateUI();
                            }
                        });

                        Thread t = new Thread(new Runnable() {
                            @Override
                            public void run() {
                                addTrackFromURLString(urlOfTrack, DataFormat.SEQUENCE);
                                trackAdditionLock.release();
                            }
                        });
                        t.start();

                    } catch (Exception ex) {
                        LOG.error("Got exception: " + ex);
                    }
                }
            };

            new Thread(prepareBrowserThread).start();

        } else {
            if (genomeContainer != null) {
                genomeContainer.updateIfRequired();
            }
        }
    } catch (Exception ex) {
        ClientMiscUtils.reportError("Error generating genome view: %s", ex);
    }
    return view;
}

From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java

protected void showConfigurationPanel() {
    if (configurationPanel == null) {
        // setup configuration panel
        updateFrameworkResources();//from  w ww  .j av  a2s .co m
        configurationPanel = new JPanel();
        configurationPanel.setLayout(new BorderLayout());
        configurationPanel.setBackground(COLOR_OUTER_BG);
        // setup logs panel

        ArrayList<String> values = new ArrayList<String>();
        Iterator<String> itr = logReaders.keySet().iterator();
        while (itr.hasNext()) {
            values.add(itr.next());
        }
        logsEnumeration = new GUIPropertyListEnumeration("Event Log :", null, values, null, 180);
        // initializing Logs
        RoundedPanel content = new RoundedPanel(10, 5, 5);
        content.setBackground(COLOR_BG);
        content.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        content.setLayout(new BoxLayout(content, BoxLayout.LINE_AXIS));
        content.add(logsEnumeration.getPropertyPanel());
        // initializing Time Sort
        initTimeSort();
        RoundedPanel content2 = new RoundedPanel(10, 5, 5);
        content2.setBackground(COLOR_BG);
        content2.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        content2.setLayout(new BoxLayout(content2, BoxLayout.LINE_AXIS));
        content2.add(timeUnitSort.getPropertyPanel());
        // initializing Measure
        ArrayList<String> values2 = new ArrayList<String>();
        values2.add(MEAN);
        values2.add(MEDIAN);
        values2.add(MIN);
        values2.add(HEUST1);
        values2.add(HEUST2);
        estimatorSort = new GUIPropertyListEnumeration("Estimator:", null, values2, null, 180);
        RoundedPanel content3 = new RoundedPanel(10, 5, 5);
        content3.setBackground(COLOR_BG);
        content3.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        content3.setLayout(new BoxLayout(content3, BoxLayout.LINE_AXIS));
        content3.add(estimatorSort.getPropertyPanel());

        // setup reference model / log configuration panel
        JPanel startPanel = new JPanel();
        startPanel.setOpaque(false);
        startPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        startPanel.setLayout(new BoxLayout(startPanel, BoxLayout.X_AXIS));
        startButton = new AutoFocusButton("start calculation");
        if (RuntimeUtils.isRunningMacOsX() == true) {
            startButton.setOpaque(true);
        }
        startButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                startCalculation();
            }
        });
        startButton.setEnabled(true);
        startPanel.add(Box.createHorizontalGlue());
        startPanel.add(startButton);
        rightPanel = new JPanel();
        rightPanel.setOpaque(false);
        rightPanel.setBorder(BorderFactory.createEmptyBorder());
        rightPanel.setLayout(new BorderLayout());
        // blank panel
        JPanel blankPanel = new JPanel();
        blankPanel.setOpaque(false);
        blankPanel.setBorder(BorderFactory.createEmptyBorder());
        blankPanel.setLayout(new BorderLayout());

        JPanel leftPanel = new JPanel();
        leftPanel.setOpaque(false);
        leftPanel.setBorder(BorderFactory.createEmptyBorder());
        leftPanel.setLayout(new BorderLayout());
        leftPanel.add(content, BorderLayout.CENTER);
        leftPanel.add(content2, BorderLayout.SOUTH);
        leftPanel.add(content3, BorderLayout.NORTH);
        // add benchmark item list to west
        rightPanel.add(blankPanel, BorderLayout.CENTER);
        rightPanel.add(startPanel, BorderLayout.SOUTH);
        configurationPanel.add(leftPanel, BorderLayout.WEST);
        configurationPanel.add(rightPanel, BorderLayout.CENTER);
    }
    // switch to configuration view
    setView(configurationPanel);
}

From source file:edu.uci.ics.jung.samples.PerspectiveTransformerDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the zoom and perspective features.
 * // w  w w . j a  v  a  2s  .  c o m
 */
@SuppressWarnings("serial")
public PerspectiveTransformerDemo() {

    // create a simple graph for the demo
    graph = TestGraphs.getOneComponentGraph();

    graphLayout = new FRLayout<String, Number>(graph);
    ((FRLayout<String, Number>) graphLayout).setMaxIterations(1000);

    Dimension preferredSize = new Dimension(600, 600);
    Map<String, Point2D> map = new HashMap<String, Point2D>();
    Transformer<String, Point2D> vlf = TransformerUtils.mapTransformer(map);
    grid = this.generateVertexGrid(map, preferredSize, 25);
    gridLayout = new StaticLayout<String, Number>(grid, vlf, preferredSize);

    final VisualizationModel<String, Number> visualizationModel = new DefaultVisualizationModel<String, Number>(
            graphLayout, preferredSize);
    vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize);
    PickedState<Number> pes = vv.getPickedEdgeState();
    vv.getRenderContext()
            .setEdgeDrawPaintTransformer(new PickableEdgePaintTransformer<Number>(pes, Color.black, Color.red));
    vv.getRenderContext().setVertexShapeTransformer(new Transformer<String, Shape>() {

        public Shape transform(String v) {
            return new Rectangle2D.Float(-10, -10, 20, 20);
        }
    });
    vv.setBackground(Color.white);

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<String>());

    Container content = getContentPane();
    GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
    content.add(gzsp);

    /**
     * the regular graph mouse for the normal view
     */
    final DefaultModalGraphMouse<Number, Number> graphMouse = new DefaultModalGraphMouse<Number, Number>();

    vv.setGraphMouse(graphMouse);

    viewSupport = new PerspectiveViewTransformSupport<String, Number>(vv);
    layoutSupport = new PerspectiveLayoutTransformSupport<String, Number>(vv);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 0.9f, vv.getCenter());
        }
    });
    final JSlider horizontalSlider = new JSlider(-120, 120, 0) {

        /* (non-Javadoc)
         * @see javax.swing.JComponent#getPreferredSize()
         */
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(80, super.getPreferredSize().height);
        }
    };

    final JSlider verticalSlider = new JSlider(-120, 120, 0) {

        /* (non-Javadoc)
         * @see javax.swing.JComponent#getPreferredSize()
         */
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(super.getPreferredSize().width, 80);
        }
    };
    verticalSlider.setOrientation(JSlider.VERTICAL);
    final ChangeListener changeListener = new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            int vval = -verticalSlider.getValue();
            int hval = horizontalSlider.getValue();

            Dimension d = vv.getSize();
            PerspectiveTransform pt = null;
            pt = PerspectiveTransform.getQuadToQuad(vval, hval, d.width - vval, -hval, d.width + vval,
                    d.height + hval, -vval, d.height - hval,

                    0, 0, d.width, 0, d.width, d.height, 0, d.height);

            viewSupport.getPerspectiveTransformer().setPerspectiveTransform(pt);
            layoutSupport.getPerspectiveTransformer().setPerspectiveTransform(pt);
            vv.repaint();
        }
    };
    horizontalSlider.addChangeListener(changeListener);
    verticalSlider.addChangeListener(changeListener);

    JPanel perspectivePanel = new JPanel(new BorderLayout());
    JPanel perspectiveCenterPanel = new JPanel(new BorderLayout());
    perspectivePanel.setBorder(BorderFactory.createTitledBorder("Perspective Controls"));
    final JButton center = new JButton("Center");
    center.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            horizontalSlider.setValue(0);
            verticalSlider.setValue(0);
        }
    });
    ButtonGroup radio = new ButtonGroup();
    JRadioButton normal = new JRadioButton("None");
    normal.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            boolean selected = e.getStateChange() == ItemEvent.SELECTED;
            if (selected) {
                if (viewSupport != null) {
                    viewSupport.deactivate();
                }
                if (layoutSupport != null) {
                    layoutSupport.deactivate();
                }
            }
            center.setEnabled(!selected);
            horizontalSlider.setEnabled(!selected);
            verticalSlider.setEnabled(!selected);
        }
    });

    final JRadioButton perspectiveView = new JRadioButton("In View");
    perspectiveView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            viewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton perspectiveModel = new JRadioButton("In Layout");
    perspectiveModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            layoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    radio.add(normal);
    radio.add(perspectiveModel);
    radio.add(perspectiveView);
    normal.setSelected(true);

    ButtonGroup graphRadio = new ButtonGroup();
    JRadioButton graphButton = new JRadioButton("Graph");
    graphButton.setSelected(true);
    graphButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(graphLayout);
                vv.repaint();
            }
        }
    });
    JRadioButton gridButton = new JRadioButton("Grid");
    gridButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(gridLayout);
                vv.repaint();
            }
        }
    });
    graphRadio.add(graphButton);
    graphRadio.add(gridButton);

    JPanel modePanel = new JPanel(new GridLayout(2, 1));
    modePanel.setBorder(BorderFactory.createTitledBorder("Display"));
    modePanel.add(graphButton);
    modePanel.add(gridButton);

    JMenuBar menubar = new JMenuBar();
    menubar.add(graphMouse.getModeMenu());
    gzsp.setCorner(menubar);

    Container controls = new JPanel(new BorderLayout());
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    JPanel perspectiveControls = new JPanel(new GridLayout(3, 1));
    zoomControls.add(plus);
    zoomControls.add(minus);
    perspectiveControls.add(normal);
    perspectiveControls.add(perspectiveModel);
    perspectiveControls.add(perspectiveView);

    controls.add(zoomControls, BorderLayout.WEST);
    controls.add(modePanel);
    perspectivePanel.add(perspectiveControls, BorderLayout.WEST);
    perspectiveCenterPanel.add(horizontalSlider, BorderLayout.SOUTH);
    perspectivePanel.add(verticalSlider, BorderLayout.EAST);
    perspectiveCenterPanel.add(center);
    perspectivePanel.add(perspectiveCenterPanel);
    controls.add(perspectivePanel, BorderLayout.EAST);

    content.add(controls, BorderLayout.SOUTH);
}

From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java

/**
 * This method initializes jScrollPane1   
 *    /*from w  ww . jav a  2s  .  c  o  m*/
 * @return javax.swing.JScrollPane   
 */
private JScrollPane getJScrollPaneSourceCode() {
    if (jScrollPaneSourceCode == null) {
        jScrollPaneSourceCode = new JScrollPane();
        jScrollPaneSourceCode.setBorder(BorderFactory.createTitledBorder(null, "Source Code",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));

        jScrollPaneSourceCode.getVerticalScrollBar().setUnitIncrement(ConstantValue.CODE_SCROLL_SIZE);

        JPanel SourceCodePanel = new JPanel();
        SourceCodePanel.setLayout(new BorderLayout());
        SourceCodePanel.add(getJTextPaneSourceCodeNum(), BorderLayout.WEST);
        SourceCodePanel.add(getJTextPaneSourceCode(), BorderLayout.CENTER);
        jScrollPaneSourceCode.setViewportView(SourceCodePanel);
    }
    return jScrollPaneSourceCode;
}