List of usage examples for java.awt BorderLayout WEST
String WEST
To view the source code for java.awt BorderLayout WEST.
Click Source Link
From source file:com.epiq.bitshark.ui.TimeDomainPanel.java
/** * This was originally generated so it needs to be cleaned up. *///from w w w . j a v a2 s . c o m private void initComponents() { topPanel = new javax.swing.JPanel(); headerPanel = new org.jdesktop.swingx.JXPanel(); chartLabelHolderPanel = new javax.swing.JPanel(); titleLabel = new javax.swing.JLabel(); titleLabelLeftSpacerPanel = new javax.swing.JPanel(); topRightPanel = new javax.swing.JPanel(); topRightMainPanel = new javax.swing.JPanel(); showICheckBox = new javax.swing.JCheckBox(); showQCheckBox = new javax.swing.JCheckBox(); rightSpacerPanel = new javax.swing.JPanel(); leftSpacerPanel = new javax.swing.JPanel(); mainPanel = new javax.swing.JPanel(); setLayout(new java.awt.BorderLayout()); topPanel.setPreferredSize(new java.awt.Dimension(0, 30)); topPanel.setLayout(new java.awt.BorderLayout()); headerPanel.setBackground(new java.awt.Color(0, 0, 0)); headerPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(121, 123, 125))); headerPanel.setPreferredSize(new java.awt.Dimension(0, 30)); headerPanel.setLayout(new java.awt.BorderLayout()); chartLabelHolderPanel.setOpaque(false); chartLabelHolderPanel.setLayout(new java.awt.BorderLayout()); titleLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); titleLabel.setText("Time Domain"); titleLabel.setForeground(new java.awt.Color(255, 255, 255)); chartLabelHolderPanel.add(titleLabel, java.awt.BorderLayout.CENTER); titleLabelLeftSpacerPanel.setOpaque(false); titleLabelLeftSpacerPanel.setPreferredSize(new java.awt.Dimension(10, 0)); chartLabelHolderPanel.add(titleLabelLeftSpacerPanel, java.awt.BorderLayout.WEST); headerPanel.add(chartLabelHolderPanel, java.awt.BorderLayout.WEST); topRightPanel.setOpaque(false); topRightPanel.setLayout(new java.awt.BorderLayout()); topRightMainPanel.setOpaque(false); topRightMainPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 2)); showICheckBox.setFont(new java.awt.Font("Tahoma", 1, 11)); showICheckBox.setForeground(new java.awt.Color(255, 255, 255)); showICheckBox.setSelected(true); showICheckBox.setText("I"); showICheckBox.setOpaque(false); showICheckBox.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { showICheckBoxActionPerformed(evt); } }); topRightMainPanel.add(showICheckBox); showQCheckBox.setFont(new java.awt.Font("Tahoma", 1, 11)); showQCheckBox.setForeground(new java.awt.Color(255, 255, 255)); showQCheckBox.setSelected(true); showQCheckBox.setText("Q"); showQCheckBox.setOpaque(false); showQCheckBox.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { showQCheckBoxActionPerformed(evt); } }); topRightMainPanel.add(showQCheckBox); topRightPanel.add(topRightMainPanel, java.awt.BorderLayout.EAST); headerPanel.add(topRightPanel, java.awt.BorderLayout.EAST); topPanel.add(headerPanel, java.awt.BorderLayout.CENTER); rightSpacerPanel.setPreferredSize(new java.awt.Dimension(0, 0)); topPanel.add(rightSpacerPanel, java.awt.BorderLayout.EAST); leftSpacerPanel.setOpaque(false); leftSpacerPanel.setPreferredSize(new java.awt.Dimension(44, 0)); topPanel.add(leftSpacerPanel, java.awt.BorderLayout.WEST); add(topPanel, java.awt.BorderLayout.NORTH); mainPanel.setLayout(new java.awt.BorderLayout()); add(mainPanel, java.awt.BorderLayout.CENTER); }
From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java
private JPanel createStudySelectionPanel() { JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setOpaque(false);/*w w w . ja v a2 s . c om*/ JPanel studyAccessionSelector = new JPanel(); studyAccessionSelector.setLayout(new BorderLayout()); studyAccessionSelector.setOpaque(false); JLabel information = new JLabel(unloadStudyHeader); information.setHorizontalAlignment(SwingConstants.RIGHT); information.setVerticalAlignment(SwingConstants.TOP); studyAccessionSelector.add(information, BorderLayout.NORTH); retrieveAndProcessStudyInformation(); JScrollPane treeScroller = new JScrollPane(studyAvailabilityTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); treeScroller.getViewport().setOpaque(false); treeScroller.setOpaque(false); treeScroller.setBorder(new EmptyBorder(1, 1, 1, 1)); treeScroller.setPreferredSize(new Dimension(380, 210)); studyAccessionSelector.add(treeScroller); container.add(studyAccessionSelector); // and need a convert button! JPanel buttonCont = new JPanel(new BorderLayout()); buttonCont.setOpaque(false); final JLabel unload = new JLabel(this.unloadButton, JLabel.RIGHT); unload.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { unload.setIcon(unloadButtonOver); } public void mouseExited(MouseEvent mouseEvent) { unload.setIcon(StudyAccessionGUI.this.unloadButton); } public void mousePressed(MouseEvent mouseEvent) { Set<String> studiesToUnload = studyAvailabilityTree .getCheckedStudies(studyAvailabilityTree.getRoot()); log.info("going to unload: "); for (String acc : studiesToUnload) { log.info("study with acc " + acc); } doUnloading(studiesToUnload); } }); buttonCont.add(unload, BorderLayout.EAST); buttonCont.add(createBackToMainMenuButton(), BorderLayout.WEST); container.add(buttonCont); return container; }
From source file:net.pandoragames.far.ui.swing.FindAndReplace.java
/** * Pannels and other swing settings//w w w .ja v a 2s. c o m */ private void init() { logger.debug("Setting up FAR Swing GUI"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ExitListener closeFARlistener = new ExitListener(); addWindowListener(closeFARlistener); setIconImage(new ImageIcon(this.getClass().getClassLoader().getResource("icons/far.gif")).getImage()); setLocation(config.getScreenCenter().x / 3, config.getScreenCenter().y / 3); this.setLayout(new BorderLayout()); InfoLine infoLine = new InfoLine(config); componentRepository = new ComponentRepository(config, infoLine, closeFARlistener, this); componentRepository.getOperationCallBackListener().addComponentStartReseted(infoLine, OperationType.REPLACE); componentRepository.getResetDispatcher().addResetable(infoLine); componentRepository.getSearchBaseListener().addResetable(infoLine); // menu MenuFactory menuFactory = new MenuFactory(config, componentRepository); this.setJMenuBar(menuFactory.createMenu()); closeFARlistener.registerCloseApplicationKeyListener(this.getJMenuBar()); this.add(infoLine, BorderLayout.NORTH); // // sub components // OperationTabPane tabbedPane = componentRepository.getTabPane(); closeFARlistener.registerCloseApplicationKeyListener(tabbedPane); // find tab FindFilePanel findFilePanel = new FindFilePanel(config, componentRepository); ButtonPanel findFileBasePanel = new ButtonPanel(OperationType.FIND, config, componentRepository); findFileBasePanel.setMainPanel(findFilePanel); tabbedPane.addTab(config.getLocalizer().localize("button.find"), findFileBasePanel); tabbedPane.setMnemonicAt(0, config.getAccessKey("menu.find")); // replace tab ReplaceContentPanel replacePanel = new ReplaceContentPanel(config, componentRepository); ButtonPanel replaceBasePanel = new ButtonPanel(OperationType.REPLACE, config, componentRepository); replaceBasePanel.setMainPanel(replacePanel); tabbedPane.addTab(config.getLocalizer().localize("button.replace"), replaceBasePanel); tabbedPane.setMnemonicAt(1, config.getAccessKey("menu.replace")); // rename tab RenameFilesPanel renamePanel = new RenameFilesPanel(config, componentRepository); ButtonPanel renameBasePanel = new ButtonPanel(OperationType.RENAME, config, componentRepository); renameBasePanel.setMainPanel(renamePanel); tabbedPane.addTab(config.getLocalizer().localize("button.rename"), renameBasePanel); tabbedPane.setMnemonicAt(2, config.getAccessKey("menu.rename")); // listener componentRepository.getOperationCallBackListener().addComponentTerminationEnabled(tabbedPane, OperationType.FIND); componentRepository.getResetDispatcher().addResetable(tabbedPane); componentRepository.getSearchBaseListener().addResetable(tabbedPane); tabbedPane.reset(); this.add(tabbedPane, BorderLayout.WEST); FileListPanel fileListPanel = new FileListPanel(config, componentRepository); this.add(fileListPanel, BorderLayout.CENTER); closeFARlistener.registerCloseApplicationKeyListener(fileListPanel); // drag and drop if (SwingConfig.getEffectiveJavaVersion() > 5) { fileImporter = new FileImporter(componentRepository); DesktopHelper.installTransferHandler(this, fileImporter); } else { infoLine.info(config.getLocalizer().localize("message.please-update-java")); } }
From source file:EdgeLabelDemo.java
/** * create an instance of a simple graph with controls to * demo the label positioning features/*from www.j a v a2 s . c om*/ * */ @SuppressWarnings("serial") public EdgeLabelDemo() { // create a simple graph for the demo graph = new SparseMultigraph<Integer, Number>(); Integer[] v = createVertices(3); createEdges(v); Layout<Integer, Number> layout = new CircleLayout<Integer, Number>(graph); vv = new VisualizationViewer<Integer, Number>(layout, new Dimension(600, 400)); vv.setBackground(Color.white); vertexLabelRenderer = vv.getRenderContext().getVertexLabelRenderer(); edgeLabelRenderer = vv.getRenderContext().getEdgeLabelRenderer(); Transformer<Number, String> stringer = new Transformer<Number, String>() { public String transform(Number e) { return "Edge:" + graph.getEndpoints(e).toString(); } }; vv.getRenderContext().setEdgeLabelTransformer(stringer); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan)); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.red, Color.yellow)); // add my listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>()); // create a frome to hold the graph final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); Container content = getContentPane(); content.add(panel); final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(graphMouse); 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, 1 / 1.1f, vv.getCenter()); } }); ButtonGroup radio = new ButtonGroup(); JRadioButton lineButton = new JRadioButton("Line"); lineButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer, Number>()); vv.repaint(); } } }); JRadioButton quadButton = new JRadioButton("QuadCurve"); quadButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<Integer, Number>()); vv.repaint(); } } }); JRadioButton cubicButton = new JRadioButton("CubicCurve"); cubicButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<Integer, Number>()); vv.repaint(); } } }); radio.add(lineButton); radio.add(quadButton); radio.add(cubicButton); graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING); JCheckBox rotate = new JCheckBox("<html><center>EdgeType<p>Parallel</center></html>"); rotate.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { AbstractButton b = (AbstractButton) e.getSource(); edgeLabelRenderer.setRotateEdgeLabels(b.isSelected()); vv.repaint(); } }); rotate.setSelected(true); MutableDirectionalEdgeValue mv = new MutableDirectionalEdgeValue(.5, .7); vv.getRenderContext().setEdgeLabelClosenessTransformer(mv); JSlider directedSlider = new JSlider(mv.getDirectedModel()) { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width /= 2; return d; } }; JSlider undirectedSlider = new JSlider(mv.getUndirectedModel()) { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width /= 2; return d; } }; JSlider edgeOffsetSlider = new JSlider(0, 50) { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width /= 2; return d; } }; edgeOffsetSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider s = (JSlider) e.getSource(); AbstractEdgeShapeTransformer<Integer, Number> aesf = (AbstractEdgeShapeTransformer<Integer, Number>) vv .getRenderContext().getEdgeShapeTransformer(); aesf.setControlOffsetIncrement(s.getValue()); vv.repaint(); } }); Box controls = Box.createHorizontalBox(); JPanel zoomPanel = new JPanel(new GridLayout(0, 1)); zoomPanel.setBorder(BorderFactory.createTitledBorder("Scale")); zoomPanel.add(plus); zoomPanel.add(minus); JPanel edgePanel = new JPanel(new GridLayout(0, 1)); edgePanel.setBorder(BorderFactory.createTitledBorder("EdgeType Type")); edgePanel.add(lineButton); edgePanel.add(quadButton); edgePanel.add(cubicButton); JPanel rotatePanel = new JPanel(); rotatePanel.setBorder(BorderFactory.createTitledBorder("Alignment")); rotatePanel.add(rotate); JPanel labelPanel = new JPanel(new BorderLayout()); JPanel sliderPanel = new JPanel(new GridLayout(3, 1)); JPanel sliderLabelPanel = new JPanel(new GridLayout(3, 1)); JPanel offsetPanel = new JPanel(new BorderLayout()); offsetPanel.setBorder(BorderFactory.createTitledBorder("Offset")); sliderPanel.add(directedSlider); sliderPanel.add(undirectedSlider); sliderPanel.add(edgeOffsetSlider); sliderLabelPanel.add(new JLabel("Directed", JLabel.RIGHT)); sliderLabelPanel.add(new JLabel("Undirected", JLabel.RIGHT)); sliderLabelPanel.add(new JLabel("Edges", JLabel.RIGHT)); offsetPanel.add(sliderLabelPanel, BorderLayout.WEST); offsetPanel.add(sliderPanel); labelPanel.add(offsetPanel); labelPanel.add(rotatePanel, BorderLayout.WEST); JPanel modePanel = new JPanel(new GridLayout(2, 1)); modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(graphMouse.getModeComboBox()); controls.add(zoomPanel); controls.add(edgePanel); controls.add(labelPanel); controls.add(modePanel); content.add(controls, BorderLayout.SOUTH); quadButton.setSelected(true); }
From source file:edu.ku.brc.specify.config.init.secwiz.SpecifyDBSecurityWizard.java
/** * @param specify/*from w w w. ja v a2 s .c o m*/ */ public SpecifyDBSecurityWizard(final WizardListener listener) { super(); this.listener = listener; System.setProperty(DBMSUserMgr.factoryName, "edu.ku.brc.dbsupport.MySQLDMBSUserMgr"); /*setupXMLPath = UIRegistry.getUserHomeAppDir() + File.separator + "setup_prefs.xml"; try { props.loadFromXML(new FileInputStream(new File(setupXMLPath))); } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifyDBSetupWizard.class, ex); }*/ HelpMgr.setLoadingPage("Load"); cardPanel = new JPanel(cardLayout); cancelBtn = createButton(UIRegistry.getResourceString("CANCEL")); helpBtn = createButton(UIRegistry.getResourceString("HELP")); JPanel btnBar; backBtn = createButton(UIRegistry.getResourceString("BACK")); nextBtn = createButton(UIRegistry.getResourceString("NEXT")); CellConstraints cc = new CellConstraints(); PanelBuilder bbpb = new PanelBuilder(new FormLayout("f:p:g,p,4px,p,4px,p,4px,p,4px", "p")); bbpb.add(helpBtn, cc.xy(2, 1)); bbpb.add(backBtn, cc.xy(4, 1)); bbpb.add(nextBtn, cc.xy(6, 1)); bbpb.add(cancelBtn, cc.xy(8, 1)); btnBar = bbpb.getPanel(); boolean doTesting = AppPreferences.getLocalPrefs().getBoolean("wizard.defaults", false); if (doTesting) { props.put("hostName", "localhost"); props.put("dbName", "testfish"); props.put("dbUserName", "root"); props.put("dbPassword", "root"); props.put("saUserName", "Master"); props.put("saPassword", "Master"); props.put("firstName", "Test"); props.put("lastName", "User"); props.put("middleInitial", "a"); props.put("email", "tester@ku.edu"); props.put("usrUsername", "testuser"); props.put("usrPassword", "testuser"); props.put("instName", "KU natural History Museum"); props.put("instAbbrev", "KU-NHM"); props.put("divName", "Fish"); props.put("divAbbrev", "IT"); props.put("collName", "Fish"); props.put("collPrefix", "KUFSH"); // Address props.put("addr1", "1345 Jayhawk Blvd"); props.put("addr2", "606 Dyche Hall"); props.put("city", "Lawrence"); props.put("state", "KS"); props.put("country", "USA"); props.put("zip", "66044"); props.put("phone", "785-864-5555"); props.put("addtaxon", true); } else { props.put("hostName", "localhost"); props.put("dbName", "specify"); } props.put("userType", SpecifyUserTypes.UserType.Manager.toString()); UIFieldFormatterMgr.setDoingLocal(true); dbPanel = new DatabasePanel(nextBtn, backBtn, "security_wiz1", true); panels.add(dbPanel); HelpMgr.registerComponent(helpBtn, dbPanel.getHelpContext()); MasterLoginPanel masterLoginPanel = new MasterLoginPanel("SA", "ENTER_SA_INFO", "security_wiz2", new String[] { "SA_USERNAME", "SA_PASSWORD" }, new String[] { "saUserName", "saPassword" }, new Integer[] { 32, 32 }, nextBtn, backBtn, true); panels.add(masterLoginPanel); panels.add(new UserPanel("SECURITY", "security_wiz3", nextBtn, backBtn, true, masterLoginPanel)); lastStep = panels.size(); if (backBtn != null) { backBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (step > 0) { step--; panels.get(step).doingPrev(); HelpMgr.registerComponent(helpBtn, panels.get(step).getHelpContext()); cardLayout.show(cardPanel, Integer.toString(step)); } updateBtnBar(); if (listener != null) { listener.panelChanged(getResourceString(panels.get(step).getPanelName() + ".TITLE")); } } }); backBtn.setEnabled(false); } nextBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (step < lastStep - 1) { panels.get(step).getValues(props); panels.get(step).aboutToLeave(); advanceToNextPanel(); } else { panels.get(step).aboutToLeave(); nextBtn.setEnabled(false); SpecifyDBSecurityWizard.this.listener.finished(); } } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (SpecifyDBSecurityWizard.this.listener != null) { if (step == lastStep) { SpecifyDBSecurityWizard.this.listener.finished(); } else { if (UIHelper.promptForAction("QUIT", "NO", "CANCEL", getResourceString("SURE_QUIT"))) { SpecifyDBSecurityWizard.this.listener.cancelled(); } } } } }); for (int i = 0; i < panels.size(); i++) { cardPanel.add(Integer.toString(i), panels.get(i)); panels.get(i).setValues(props); } cardLayout.show(cardPanel, "0"); if (dbPanel != null) { dbPanel.updateBtnUI(); } PanelBuilder builder = new PanelBuilder(new FormLayout("f:p:g", "f:p:g,10px,p")); builder.add(cardPanel, cc.xy(1, 1)); builder.add(btnBar, cc.xy(1, 3)); builder.setDefaultDialogBorder(); setLayout(new BorderLayout()); PanelBuilder iconBldr = new PanelBuilder(new FormLayout("20px, f:p:g,p,f:p:g,8px", "20px,t:p,f:p:g, 8px")); JLabel iconLbl = new JLabel(IconManager.getIcon(getIconName())); iconLbl.setVerticalAlignment(SwingConstants.TOP); iconBldr.add(iconLbl, cc.xy(2, 3)); add(iconBldr.getPanel(), BorderLayout.WEST); add(builder.getPanel(), BorderLayout.CENTER); progressBar = new JProgressBar(0, lastStep - 1); progressBar.setStringPainted(true); add(progressBar, BorderLayout.SOUTH); panels.get(0).updateBtnUI(); }
From source file:satalitelist.EdgeLabelDemo.java
/** * create an instance of a simple graph with controls to * demo the label positioning features/*from www . j a v a 2 s. c o m*/ * */ @SuppressWarnings("serial") public EdgeLabelDemo(StemAndCycleList al) { cities = (ArrayList<INode>) al.list; list = al; al.score = al.getCycleScore(); // create a simple graph for the demo graph = new SparseMultigraph<Integer, MyEdge>(); //Integer[] v = createVertices(7); fillSevenCitiesWithPrices(); for (INode n : cities) { graph.addVertex(Integer.parseInt(n.toString())); } createVertices(); //createEdges(v); Layout<Integer, MyEdge> layout = new FRLayout2<Integer, MyEdge>(graph); vv = new VisualizationViewer<Integer, MyEdge>(layout, new Dimension(1000, 800)); vv.setBackground(Color.white); vertexLabelRenderer = vv.getRenderContext().getVertexLabelRenderer(); edgeLabelRenderer = vv.getRenderContext().getEdgeLabelRenderer(); vv.getRenderContext().setEdgeLabelTransformer(new Transformer<MyEdge, String>() { public String transform(MyEdge i) { return i.toString(); } }); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<MyEdge>(vv.getPickedEdgeState(), Color.black, Color.cyan)); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.red, Color.yellow)); // add my listener for ToolTips vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Integer>()); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<MyEdge, Stroke>() { public Stroke transform(MyEdge i) { switch (i.kind) { case NORMAL: return new BasicStroke(2, 1, 1, 0, new float[] { 10, 0 }, 0); case VIRTUAL: return new BasicStroke(2, 1, 1, 0, new float[] { 5 }, 0); case INVISIBLE: return new BasicStroke(1, 1, 1, 0, new float[] { 1, 10 }, 0); } throw new RuntimeException("No such a type"); } }); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); // create a frome to hold the graph final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); Container content = getContentPane(); content.add(panel); final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(graphMouse); 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, 1 / 1.1f, vv.getCenter()); } }); ButtonGroup radio = new ButtonGroup(); JRadioButton lineButton = new JRadioButton("Line"); lineButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer, MyEdge>()); vv.repaint(); } } }); JRadioButton quadButton = new JRadioButton("QuadCurve"); quadButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<Integer, MyEdge>()); vv.repaint(); } } }); JRadioButton cubicButton = new JRadioButton("CubicCurve"); cubicButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<Integer, MyEdge>()); vv.repaint(); } } }); radio.add(quadButton); radio.add(cubicButton); radio.add(lineButton); graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING); Box controls = Box.createHorizontalBox(); JPanel zoomPanel = new JPanel(new GridLayout(0, 1)); zoomPanel.setBorder(BorderFactory.createTitledBorder("Scale")); zoomPanel.add(plus); zoomPanel.add(minus); JPanel edgePanel = new JPanel(new GridLayout(0, 1)); edgePanel.setBorder(BorderFactory.createTitledBorder("EdgeType Type")); edgePanel.add(lineButton); edgePanel.add(quadButton); edgePanel.add(cubicButton); JPanel rotatePanel = new JPanel(); rotatePanel.setBorder(BorderFactory.createTitledBorder("Alignment")); rotatePanel.add(cycleLabel); rotatePanel.add(stemLabel); rotatePanel.add(otherEndLabel); JPanel labelPanel = new JPanel(new BorderLayout()); labelPanel.add(rotatePanel, BorderLayout.WEST); JPanel modePanel = new JPanel(new GridLayout(2, 1)); modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(graphMouse.getModeComboBox()); JPanel movePanel = new JPanel(new GridLayout(2, 1)); modePanel.setBorder(BorderFactory.createTitledBorder("Make move")); JButton button = new JButton("Make move"); button.addActionListener(new StemAndCycleAl()); modePanel.add(button); controls.add(zoomPanel); controls.add(edgePanel); controls.add(labelPanel); controls.add(modePanel); controls.add(movePanel); content.add(controls, BorderLayout.SOUTH); lineButton.setSelected(true); }
From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java
private final JPanel buildTestbedPanel() throws RemoteException { JPanel testbedPanel = new JPanel(new BorderLayout()); testbedPanel.setBorder(new TitledBorder("Physical Deployments")); // --- left-side ------------------------------------------------- JPanel sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED)); testbedList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); testbedList.setListData(testbedManager.getTestbedList().toArray()); testbedList.addListSelectionListener(new TestbedListSelectionListener()); sidePanel.add(new JScrollPane(testbedList), BorderLayout.CENTER); testbedPanel.add(sidePanel, BorderLayout.WEST); // --- right-side ------------------------------------------------ sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED)); JPanel rsTopPanel = new JPanel(new BorderLayout()); rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50)); JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5)); labelPanel.add(new JLabel("Name: ")); labelPanel.add(new JLabel("Description: ")); JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5)); infoPanel.add(testbedName);// w ww .j a v a 2 s. c o m testbedName.setEditable(false); infoPanel.add(testbedDescription); testbedDescription.setEditable(false); rsTopPanel.add(labelPanel, BorderLayout.WEST); rsTopPanel.add(infoPanel, BorderLayout.CENTER); sidePanel.add(rsTopPanel, BorderLayout.NORTH); testbedPanel.add(sidePanel, BorderLayout.EAST); return testbedPanel; }
From source file:AltiConsole.AltiConsoleMainScreen.java
/** * Constructs main screen of the application. * /*from ww w . j ava 2 s. c o m*/ * @param title * the frame title. */ public AltiConsoleMainScreen(final String title) { super(title); trans = Application.getTranslator(); // //////// Menu code starts her ////////////// // File fileMenu = new JMenu(); fileMenu.setText(trans.get("AltiConsoleMainScreen.File")); // Load data loadDataMenuItem = new JMenuItem(); loadDataMenuItem.setText(trans.get("AltiConsoleMainScreen.RetrieveFlightData")); loadDataMenuItem.setActionCommand("RETRIEVE_FLIGHT"); loadDataMenuItem.addActionListener(this); eraseAllDataMenuItem = new JMenuItem(); eraseAllDataMenuItem.setText(trans.get("AltiConsoleMainScreen.EraseFlightData")); eraseAllDataMenuItem.setActionCommand("ERASE_FLIGHT"); eraseAllDataMenuItem.addActionListener(this); // Save as saveASMenuItem = new JMenuItem(); saveASMenuItem.setText(trans.get("AltiConsoleMainScreen.saveFlightData")); saveASMenuItem.setActionCommand("SAVE_FLIGHT"); saveASMenuItem.addActionListener(this); // Exit exitMenuItem = new JMenuItem(); exitMenuItem.setText(trans.get("AltiConsoleMainScreen.Exit")); exitMenuItem.setActionCommand("EXIT"); exitMenuItem.addActionListener(this); fileMenu.add(saveASMenuItem); fileMenu.add(loadDataMenuItem); fileMenu.add(eraseAllDataMenuItem); fileMenu.add(exitMenuItem); // Option menu optionMenu = new JMenu(trans.get("AltiConsoleMainScreen.Option")); preferencesMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.Preferences")); preferencesMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("pref\n"); Preferences.showPreferences(AltiConsoleMainScreen.this); //LicenseDialog.showPreferences(AltiConsoleMainScreen.this); System.out.println("change units\n"); String Units; System.out.println(UserPref.getAppUnits()); if (Utils.equals(UserPref.getAppUnits(), "Unit.Metrics")) Units = trans.get("Unit.Metrics"); else Units = trans.get("Unit.Imperial"); chart.getXYPlot().getRangeAxis() .setLabel(trans.get("AltiConsoleMainScreen.altitude") + " (" + Units + ")"); if (Serial.getConnected()) { RetrievingFlight(); } } }); optionMenu.add(preferencesMenuItem); // Configuration menu altiConfigMenu = new JMenu(trans.get("AltiConsoleMainScreen.ConfigAltimeter")); retrieveAltiConfigMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.RetrieveAltiConfig")); retrieveAltiConfigMenuItem.setActionCommand("RETRIEVE_ALTI_CFG"); retrieveAltiConfigMenuItem.addActionListener(this); altiConfigMenu.add(retrieveAltiConfigMenuItem); uploadFirmwareMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.UploadFirmware")); uploadFirmwareMenuItem.setActionCommand("UPLOAD_FIRMWARE"); uploadFirmwareMenuItem.addActionListener(this); altiConfigMenu.add(uploadFirmwareMenuItem); // Help helpMenu = new JMenu(trans.get("AltiConsoleMainScreen.Help")); jJMenuBar = new JMenuBar(); // Manual onLineHelpMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.onLineHelp")); onLineHelpMenuItem.setActionCommand("ON_LINE_HELP"); onLineHelpMenuItem.addActionListener(this); // license licenseMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.license")); licenseMenuItem.setActionCommand("LICENSE"); licenseMenuItem.addActionListener(this); // AboutScreen aboutMenuItem = new JMenuItem(); aboutMenuItem.setText(trans.get("AltiConsoleMainScreen.About")); aboutMenuItem.setActionCommand("ABOUT"); aboutMenuItem.addActionListener(this); helpMenu.add(onLineHelpMenuItem); helpMenu.add(licenseMenuItem); helpMenu.add(aboutMenuItem); jJMenuBar.add(fileMenu); jJMenuBar.add(optionMenu); jJMenuBar.add(altiConfigMenu); jJMenuBar.add(helpMenu); this.setJMenuBar(jJMenuBar); // ///// end of Menu code // Button retrieveFlights = new JButton(); retrieveFlights.setText(trans.get("AltiConsoleMainScreen.RetrieveFlights")); retrieveFlights.setActionCommand("RETRIEVE_FLIGHT"); retrieveFlights.addActionListener(this); retrieveFlights.setToolTipText(trans.get("AltiConsoleMainScreen.ttipRetrieveFlight")); // combo serial rate String[] serialRateStrings = { "300", "1200", "2400", "4800", "9600", "14400", "19200", "28800", "38400", "57600", "115200" }; serialRatesLabel = new JLabel(trans.get("AltiConsoleMainScreen.comPortSpeed") + " "); serialRates = new JComboBox(); System.out.println(UserPref.getDefComSpeed() + "\n"); for (int i = 0; i < serialRateStrings.length; i++) { serialRates.addItem(serialRateStrings[i]); if (Utils.equals(UserPref.getDefComSpeed(), serialRateStrings[i])) { serialRates.setSelectedIndex(i); } } serialRates.setToolTipText(trans.get("AltiConsoleMainScreen.ttipChoosePortSpeed")); comPortsLabel = new JLabel(trans.get("AltiConsoleMainScreen.port") + " "); comPorts = new JComboBox(); comPorts.setActionCommand("comPorts"); comPorts.addActionListener(this); comPorts.setToolTipText(trans.get("AltiConsoleMainScreen.ttipChooseAltiport")); listData = new DefaultListModel(); flightList = new JXList(listData); flightList.addListSelectionListener(new ValueReporter()); JPanel TopPanelLeft = new JPanel(); TopPanelLeft.setLayout(new BorderLayout()); TopPanelLeft.add(comPortsLabel, BorderLayout.WEST); TopPanelLeft.add(comPorts, BorderLayout.EAST); JPanel TopPanelMiddle = new JPanel(); TopPanelMiddle.setLayout(new BorderLayout()); TopPanelMiddle.add(retrieveFlights, BorderLayout.WEST); JPanel TopPanelRight = new JPanel(); TopPanelRight.setLayout(new BorderLayout()); TopPanelRight.add(serialRatesLabel, BorderLayout.WEST); TopPanelRight.add(serialRates, BorderLayout.EAST); JPanel TopPanel = new JPanel(); TopPanel.setLayout(new BorderLayout()); TopPanel.add(TopPanelRight, BorderLayout.EAST); TopPanel.add(TopPanelMiddle, BorderLayout.CENTER); TopPanel.add(TopPanelLeft, BorderLayout.WEST); JPanel MiddlePanel = new JPanel(); MiddlePanel.setLayout(new BorderLayout()); MiddlePanel.add(TopPanel, BorderLayout.NORTH); MiddlePanel.add(flightList, BorderLayout.WEST); String Units; if (Utils.equals(UserPref.getAppUnits(), "Unit.Metrics")) Units = trans.get("Unit.Metrics"); else Units = trans.get("Unit.Imperial"); chart = ChartFactory.createXYLineChart(trans.get("AltiConsoleMainScreen.Title"), trans.get("AltiConsoleMainScreen.time"), trans.get("AltiConsoleMainScreen.altitude") + " (" + Units + ")", null); chart.setBackgroundPaint(Color.white); System.out.println(chart.getSubtitle(0)); this.plot = chart.getXYPlot(); this.plot.setBackgroundPaint(Color.lightGray); this.plot.setDomainGridlinePaint(Color.white); this.plot.setRangeGridlinePaint(Color.white); final ValueAxis axis = this.plot.getDomainAxis(); axis.setAutoRange(true); final NumberAxis rangeAxis2 = new NumberAxis("Range Axis 2"); rangeAxis2.setAutoRangeIncludesZero(false); final ChartPanel chartPanel = new ChartPanel(chart); MiddlePanel.add(chartPanel, BorderLayout.CENTER); JPanel InfoPanel = new JPanel(new MigLayout("fill")); InfoPanel.add(new JLabel(trans.get("AltiConsoleMainScreen.ApogeeAltitude")), "gapright para"); apogeeAltitudeLabel = new JLabel(); InfoPanel.add(apogeeAltitudeLabel, "growx"); InfoPanel.add(new JLabel(trans.get("AltiConsoleMainScreen.MainAltitude")), "gapright para"); mainAltitudeLabel = new JLabel(); InfoPanel.add(mainAltitudeLabel, "growx"); flightNbrLabel = new JLabel(); InfoPanel.add(new JLabel(trans.get("AltiConsoleMainScreen.NbrOfPoint")), "growx"); nbrPointLabel = new JLabel(); InfoPanel.add(nbrPointLabel, "wrap rel,growx"); txtLog = new JTextArea(5, 70); txtLog.setEditable(false); txtLog.setAutoscrolls(true); scrollPane = new JScrollPane(txtLog); scrollPane.setAutoscrolls(true); // BottomPanel.add(scrollPane, BorderLayout.WEST); InfoPanel.add(scrollPane, "span"); // MiddlePanel.add(BottomPanel, BorderLayout.SOUTH); MiddlePanel.add(InfoPanel, BorderLayout.SOUTH); setContentPane(MiddlePanel); try { try { Serial = new AltimeterSerial(this); Serial.searchForPorts(); } catch (UnsatisfiedLinkError e) { System.out.println("USB Library rxtxSerial.dll Not Found"); System.out.println("Exception:" + e.toString() + ":" + e.getMessage()); System.out.println(e.toString()); JOptionPane.showMessageDialog(null, "You must copy the appropriate rxtxSerial.dll \n " + "to your local 32 bit or 64 bitjava JRE installation\n\n" + " .../arduino-1.0.1-windows/arduino-1.0.1/rxtxSerial.dll\n" + "to\n C:/Program Files (x86)/Java/jre7/bin/rxtxSerial.dll\n" + "also right click Properties->Unblock", trans.get("AltiConsoleMainScreen.InstallationProblem"), JOptionPane.WARNING_MESSAGE); } } catch (NoClassDefFoundError e) { System.out.println("Missing RXTXcomm.jar in java installation"); System.out.println("Exception:" + e.toString() + ":" + e.getMessage()); System.out.println(e.toString()); JOptionPane.showMessageDialog(null, "You must copy RXTXcomm.jar from the Arduino software\n " + "to your local 32 bit java JRE installation\n\n" + " .../arduino-1.0.1-windows/arduino-1.0.1/lib/RXTXcomm.jar\n" + "to\n C:/Program Files (x86)/Java/jre7/lib/ext/RXTXcomm.jar\n" + "also right click Properties->Unblock", trans.get("AltiConsoleMainScreen.InstallationProblem"), JOptionPane.WARNING_MESSAGE); } }
From source file:com.epiq.bitshark.ui.IVQPanel.java
/** * This was originally generated code,/*from www.j a va 2 s . co m*/ * so it needs a little cleanup. */ private void initComponents() { topPanel = new javax.swing.JPanel(); headerPanel = new org.jdesktop.swingx.JXPanel(); labelHolderPanel = new javax.swing.JPanel(); chartLabel = new javax.swing.JLabel(); titleLabelLeftSpacer = new javax.swing.JPanel(); topRightPanel = new javax.swing.JPanel(); topRightMainPanel = new javax.swing.JPanel(); rightSpacer = new javax.swing.JPanel(); leftSpacer = new javax.swing.JPanel(); mainPanel = new javax.swing.JPanel(); setLayout(new java.awt.BorderLayout()); topPanel.setPreferredSize(new java.awt.Dimension(0, 30)); topPanel.setLayout(new java.awt.BorderLayout()); headerPanel.setBackground(new java.awt.Color(0, 0, 0)); headerPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(121, 123, 125))); headerPanel.setPreferredSize(new java.awt.Dimension(0, 30)); headerPanel.setLayout(new java.awt.BorderLayout()); labelHolderPanel.setOpaque(false); labelHolderPanel.setLayout(new java.awt.BorderLayout()); chartLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N chartLabel.setForeground(new java.awt.Color(255, 255, 255)); chartLabel.setText("I versus Q"); labelHolderPanel.add(chartLabel, java.awt.BorderLayout.CENTER); titleLabelLeftSpacer.setOpaque(false); titleLabelLeftSpacer.setPreferredSize(new java.awt.Dimension(10, 0)); labelHolderPanel.add(titleLabelLeftSpacer, java.awt.BorderLayout.WEST); headerPanel.add(labelHolderPanel, java.awt.BorderLayout.WEST); topRightPanel.setOpaque(false); topRightPanel.setLayout(new java.awt.BorderLayout()); topRightMainPanel.setOpaque(false); topRightMainPanel.setPreferredSize(new java.awt.Dimension(40, 0)); topRightMainPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 2)); topRightPanel.add(topRightMainPanel, java.awt.BorderLayout.EAST); headerPanel.add(topRightPanel, java.awt.BorderLayout.EAST); topPanel.add(headerPanel, java.awt.BorderLayout.CENTER); rightSpacer.setPreferredSize(new java.awt.Dimension(7, 0)); topPanel.add(rightSpacer, java.awt.BorderLayout.EAST); leftSpacer.setOpaque(false); leftSpacer.setPreferredSize(new java.awt.Dimension(44, 0)); topPanel.add(leftSpacer, java.awt.BorderLayout.WEST); add(topPanel, java.awt.BorderLayout.NORTH); mainPanel.setLayout(new java.awt.BorderLayout()); add(mainPanel, java.awt.BorderLayout.CENTER); }
From source file:org.isatools.gui.datamanager.exportisa.ExportISAGUI.java
private JPanel createSouthPanel() { JPanel southPanel = new JPanel(new BorderLayout()); southPanel.setOpaque(false);/*from ww w .j a va 2 s. c o m*/ errorDisplay = new JLabel(warningIcon); UIHelper.renderComponent(errorDisplay, UIHelper.VER_11_BOLD, UIHelper.LIGHT_GREY_COLOR, false); errorDisplay.setVisible(false); southPanel.add(UIHelper.wrapComponentInPanel(errorDisplay), BorderLayout.NORTH); southPanel.add(createBackToMainMenuButton(), BorderLayout.WEST); final JLabel exportISAButton = new JLabel(exportISAIcon); exportISAButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { exportISAButton.setIcon(exportISAIcon); if (!selectedOutputFolderExists() && !exportToRepository()) { localDirectoryLocation.setBackgroundToError(); } else { if (studyAvailabilityTree.getCheckedStudies(studyAvailabilityTree.getRoot()).size() == 0) { errorDisplay.setText("<html>please select <i>at least one study</i> to export!</html>"); errorDisplay.setVisible(true); } else { errorDisplay.setVisible(false); firePropertyChange("doISATabExport", "", "doExport"); } } } @Override public void mouseExited(MouseEvent mouseEvent) { exportISAButton.setIcon(exportISAIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { exportISAButton.setIcon(exportISAIconOver); } }); southPanel.add(exportISAButton, BorderLayout.EAST); return southPanel; }