List of usage examples for javax.swing SwingConstants LEFT
int LEFT
To view the source code for javax.swing SwingConstants LEFT.
Click Source Link
From source file:levelBuilder.DialogMaker.java
/** * Displays key (i.e. legend) to the graph. *///from w ww .j a v a 2s . c o m private static void keyWindow() { JPanel panel = new JPanel(new GridLayout(0, 1, 0, 0)); BufferedImage img1 = null; BufferedImage img2 = null; BufferedImage img3 = null; BufferedImage img4 = null; BufferedImage img5 = null; try { img1 = ImageIO.read(new File(imgDir + "green.png")); img2 = ImageIO.read(new File(imgDir + "red.png")); img3 = ImageIO.read(new File(imgDir + "blue.png")); img4 = ImageIO.read(new File(imgDir + "circle.png")); img5 = ImageIO.read(new File(imgDir + "square.png")); } catch (IOException e) { e.printStackTrace(); } panel.add(new JLabel("Initial Node", new ImageIcon(img1), SwingConstants.LEFT)); panel.add(new JLabel("End Node", new ImageIcon(img2), SwingConstants.LEFT)); panel.add(new JLabel("Intermediate Node", new ImageIcon(img3), SwingConstants.LEFT)); panel.add(new JLabel("Player Node", new ImageIcon(img4), SwingConstants.LEFT)); panel.add(new JLabel("NPC Node", new ImageIcon(img5), SwingConstants.LEFT)); JFrame frame = new JFrame("Key"); panel.setOpaque(true); frame.setContentPane(panel); frame.pack(); frame.setLocation(windowWidth, 0); frame.setVisible(true); verticalWindowPlacement += frame.getBounds().height + frame.getBounds().y; horizontalWindowPlacement += frame.getBounds().width; }
From source file:org.pentaho.support.standalone.SDSupportUtility.java
/** * initializing UI/*from ww w .j a va2s. co m*/ * * @throws Exception */ public SDSupportUtility() throws Exception { prop = loadProperty(); setResizable(false); setTitle(SDConstant.PENT_SUP_WIZARD); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 665, 516); contentPane = new JPanel(); contentPane.setBackground(UIManager.getColor("Button.background")); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblLastAttached = new JLabel("Last Attached"); lblLastAttached.setOpaque(false); lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT); lblLastAttached.setBounds(322, 335, 127, 23); contentPane.add(lblLastAttached); JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard"); lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51)); lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP); lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT); lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23)); lblPentahoCustomerSupport.setBounds(130, 109, 506, 37); contentPane.add(lblPentahoCustomerSupport); JLabel lbllogo = new JLabel(); lbllogo.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png"))); lbllogo.setBounds(10, 11, 409, 93); contentPane.add(lbllogo); chckbxNewCheckBoxEnvironment = new JCheckBox("Environment"); chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.ENVIRONMENT); } else { ArgList.remove(SDConstant.ENVIRONMENT); } } }); chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23); contentPane.add(chckbxNewCheckBoxEnvironment); chckbxNewCheckBoxEnvironment.setOpaque(false); chckbxNewCheckBoxStructure = new JCheckBox("Structure Details"); chckbxNewCheckBoxStructure.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.STRUCT); } else { ArgList.remove(SDConstant.STRUCT); } } }); chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23); contentPane.add(chckbxNewCheckBoxStructure); chckbxNewCheckBoxStructure.setOpaque(false); chckbxLogs = new JCheckBox("Logs"); chckbxLogs.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LOGS); } else { ArgList.remove(SDConstant.LOGS); } } }); chckbxLogs.setBounds(377, 164, 248, 23); contentPane.add(chckbxLogs); chckbxLogs.setOpaque(false); chckbxGetSecureFiles = new JCheckBox("Secure Files"); chckbxGetSecureFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.SECURITY); } else { ArgList.remove(SDConstant.SECURITY); } } }); chckbxGetSecureFiles.setBounds(109, 190, 243, 23); contentPane.add(chckbxGetSecureFiles); chckbxGetSecureFiles.setOpaque(false); chckbxMd5 = new JCheckBox("MD5 Hash Value"); chckbxMd5.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.MD5); } else { ArgList.remove(SDConstant.MD5); } } }); chckbxMd5.setBounds(109, 216, 243, 23); contentPane.add(chckbxMd5); chckbxMd5.setOpaque(false); chckbxDbdetails = new JCheckBox("Datasource Details"); chckbxDbdetails.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.DATASOURCE); } else { ArgList.remove(SDConstant.DATASOURCE); } } }); chckbxDbdetails.setBounds(109, 294, 243, 23); contentPane.add(chckbxDbdetails); chckbxDbdetails.setOpaque(false); chckbxLicense = new JCheckBox("License File"); chckbxLicense.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LICENSE); } else { ArgList.remove(SDConstant.LICENSE); } } }); chckbxLicense.setBounds(109, 164, 243, 23); contentPane.add(chckbxLicense); chckbxLicense.setOpaque(false); chckbxProcesslist = new JCheckBox("Running Process"); chckbxProcesslist.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.RUNNING_TASK); } else { ArgList.remove(SDConstant.RUNNING_TASK); } } }); chckbxProcesslist.setBounds(109, 242, 243, 23); contentPane.add(chckbxProcesslist); chckbxProcesslist.setOpaque(false); chckbxTomcatxml = new JCheckBox("XML files from Tomcat"); chckbxTomcatxml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); tomcatXml = true; } else { ArgList.remove(SDConstant.FILE); tomcatXml = false; } } }); chckbxTomcatxml.setBounds(377, 242, 248, 23); contentPane.add(chckbxTomcatxml); chckbxTomcatxml.setOpaque(false); chckbxServerXml = new JCheckBox("XML files from Server"); chckbxServerXml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverXml = true; } else { ArgList.remove(SDConstant.FILE); serverXml = false; } } }); chckbxServerXml.setBounds(377, 216, 248, 23); contentPane.add(chckbxServerXml); chckbxServerXml.setOpaque(false); chckbxGetBatfiles = new JCheckBox("Start up files from server"); chckbxGetBatfiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverBatFile = true; } else { ArgList.remove(SDConstant.FILE); serverBatFile = false; } } }); chckbxGetBatfiles.setBounds(377, 268, 248, 23); contentPane.add(chckbxGetBatfiles); chckbxGetBatfiles.setOpaque(false); chckbxServerproperties = new JCheckBox("Properites files from server"); chckbxServerproperties.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverProrperties = true; } else { ArgList.remove(SDConstant.FILE); serverProrperties = false; } } }); chckbxServerproperties.setBounds(377, 294, 248, 23); contentPane.add(chckbxServerproperties); chckbxServerproperties.setOpaque(false); btnNewButton = new JButton("Package"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { if (installType.equalsIgnoreCase("Manual")) { if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } else { WEB_XML = new StringBuilder(); WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator) .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO) .append(File.separator).append(SDConstant.WEB_INF).append(File.separator) .append(SDConstant.WEB_XML); PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString()); prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH); prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH); } } if (prop.getProperty(SDConstant.BI_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error", JOptionPane.ERROR_MESSAGE); } if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } disableAll(); setBIServerPath(prop); final String data = textFieldBrowser.getText(); if (!data.equalsIgnoreCase(null)) { ArgList.add(SDConstant.BROWSER); } String[] array = new String[ArgList.size()]; int count = 0; for (int i = 0; i < ArgList.size(); i++) { String retName = ArgList.get(i); if (retName.equals("file")) { if (count == 0) { array[i] = retName; count++; } } else { array[i] = retName; } } ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME); factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory"); ConfigRetreiver[] config = factory.getConfigRetrevier(array); ExecutorService service = Executors.newFixedThreadPool(10); for (final ConfigRetreiver configobj : config) { if (null != configobj) { configobj.setBISeverPath(prop); configobj.setServerName("biserver"); if (installType.equalsIgnoreCase("Installer")) { configobj.setInstallType("Installer"); } else if (installType.equalsIgnoreCase("Archive")) { configobj.setInstallType("Archive"); } else if (installType.equalsIgnoreCase("Manual")) { configobj.setInstallType("Manual"); } if (configobj instanceof FileRetriever) { configobj.setBidiXml(serverXml); configobj.setBidiBatFile(serverBatFile); configobj.setBidiProrperties(serverProrperties); configobj.setTomcatXml(tomcatXml); } if (configobj instanceof BrowserInfoRetriever) { configobj.setBrowserInfo(data); } service.execute(new Runnable() { public void run() { if (null != configobj) configobj.readAndSaveConfiguration(prop); } }); } } btnNewButton.setVisible(false); progressBar.setVisible(true); ProgressThread thread = new ProgressThread(); thread.setSupport(getSupport()); thread.setProp(prop); new Thread(thread).start(); service.shutdown(); } catch (Exception e1) { e1.printStackTrace(); } } }); chckbxSelectAll = new JCheckBox("Select/ De-select"); chckbxSelectAll.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { selectAll(); } else { deSelectAll(); } } }); chckbxSelectAll.setBounds(46, 138, 201, 23); chckbxSelectAll.setOpaque(false); contentPane.add(chckbxSelectAll); btnNewButton.setForeground(SystemColor.infoText); btnNewButton.setBounds(10, 430, 639, 37); contentPane.add(btnNewButton); chckbxServerproperties.setOpaque(false); JLabel lblAttach = new JLabel("Attach Artifact"); lblAttach.setHorizontalAlignment(SwingConstants.LEFT); lblAttach.setBounds(32, 335, 177, 23); contentPane.add(lblAttach); lblAttach.setOpaque(false); JButton btnNewButtonBrowse = new JButton("Browse"); btnNewButtonBrowse.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveSelectedFile(prop); JFrame parentFrame = new JFrame(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Specify a file to save"); fileChooser.setMultiSelectionEnabled(true); int userSelection = fileChooser.showSaveDialog(parentFrame); if (userSelection == JFileChooser.APPROVE_OPTION) { fileToSave = fileChooser.getSelectedFiles(); for (int i = 0; i < fileToSave.length; i++) { File file = fileToSave[i]; String artifactpath = file.getAbsolutePath(); File f = new File(artifactpath); String absolutefilename = f.getName(); String filename = ArtifactsDirectory.concat(absolutefilename); CopyFile artifactcopy = new CopyFile(artifactpath, filename); try { artifactcopy.copy(); } catch (Exception e1) { e1.printStackTrace(); } } uploadedFiles(); rowList = new JList(model); listScrollPane.setViewportView(rowList); panel.add(listScrollPane); } rowList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblDelete.setVisible(true); } }); } }); btnNewButtonBrowse.setBounds(208, 335, 104, 23); contentPane.add(btnNewButtonBrowse); btnNewButtonBrowse.setOpaque(false); textFieldBrowser = new JTextField(); textFieldBrowser.setBounds(208, 364, 441, 23); contentPane.add(textFieldBrowser); textFieldBrowser.setColumns(10); progressBar = new JProgressBar(0, 100); progressBar.setBounds(8, 437, 639, 24); progressBar.setVisible(false); progressBar.setStringPainted(true); contentPane.add(progressBar); JLabel lblBrowserInformation = new JLabel("Browser Information"); lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT); lblBrowserInformation.setLabelFor(textFieldBrowser); lblBrowserInformation.setBounds(32, 368, 174, 14); contentPane.add(lblBrowserInformation); panel = new JPanel(); panel.setBounds(423, 325, 127, 33); contentPane.add(panel); panel.setLayout(null); listScrollPane = new JScrollPane(); listScrollPane.setBounds(0, 0, 127, 33); panel.add(listScrollPane); lblDelete = new JLabel(""); lblDelete.setBounds(552, 325, 22, 23); lblDelete.setVisible(false); lblDelete.setIcon( new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png"))); contentPane.add(lblDelete); lblDelete.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?"); if (option == JOptionPane.YES_OPTION) { String sel = rowList.getSelectedValue().toString(); String selected = dir + "/" + sel; File fileExists = new File(selected); fileExists.delete(); model.remove(sel.indexOf(sel)); lblDelete.setVisible(false); } } }); JLabel instalType = new JLabel("Installation Type : "); instalType.setBounds(32, 395, 177, 23); instalType.setVisible(true); contentPane.add(instalType); ButtonGroup btnGrp = new ButtonGroup(); rdbtnInstaller = new JRadioButton("Installer"); rdbtnInstaller.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Installer"; } }); rdbtnInstaller.setBounds(208, 395, 104, 23); rdbtnInstaller.setSelected(true); contentPane.add(rdbtnInstaller); btnGrp.add(rdbtnInstaller); rdbtnArchive = new JRadioButton("Archive"); rdbtnArchive.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Archive"; } }); rdbtnArchive.setBounds(333, 395, 104, 23); contentPane.add(rdbtnArchive); btnGrp.add(rdbtnArchive); rdbtnManual = new JRadioButton("Manual"); rdbtnManual.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Manual"; } }); rdbtnManual.setBounds(460, 395, 127, 27); contentPane.add(rdbtnManual); btnGrp.add(rdbtnManual); JLabel lblBackground = new JLabel(); lblBackground.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg"))); lblBackground.setBackground(SystemColor.controlHighlight); lblBackground.setHorizontalAlignment(SwingConstants.CENTER); lblBackground.setBounds(0, 0, 659, 488); contentPane.add(lblBackground); }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDRInputController.java
@Override protected void addToDRAnalysis() { List<DoseResponsePair> selectedConditions = getSelectedConditions(); if (selectedConditions != null && !selectedConditions.equals(conditionsList)) { for (DoseResponsePair selectedCondition : selectedConditions) { //only add to list if list does not contain this condition already if (!conditionsList.contains(selectedCondition)) { conditionsList.add(selectedCondition); }// w ww.j ava 2 s . co m } // make a new analysis group // override variable if one existed already doseResponseController.setdRAnalysisGroup(new GenericDoseResponseAnalysisGroup(conditionsList)); doseResponseController.setFirstFitting(true); // populate bottom table with the analysis group slopesTable.setModel(createTableModel(doseResponseController.getdRAnalysisGroup())); slopesTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT)); } }
From source file:org.jfree.chart.demo.CompassDemo.java
/** * Initialises the user interface./* w ww .j a va 2s . co m*/ * * @throws Exception if there are any exceptions. */ void jbInit() throws Exception { this.titledBorder1 = new TitledBorder(""); this.titledBorder2 = new TitledBorder(""); this.titledBorder3 = new TitledBorder(""); setLayout(this.gridLayout1); this.panelCompassHolder.setLayout(this.borderLayout); this.windNullCheckBox.setHorizontalTextPosition(SwingConstants.LEADING); this.windNullCheckBox.setText("Null"); this.windNullCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(final ActionEvent e) { checkWindNullActionPerformed(e); } }); this.shipNullCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.shipNullCheckBox.setText("Null"); this.shipNullCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(final ActionEvent e) { checkShipNullActionPerformed(e); } }); this.spinShip.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { if (DEBUG) { System.out.println("compassDemo:spinShipPropertyChange"); } final Spinner spinner = (Spinner) evt.getSource(); if (spinner.isEnabled()) { shipData.setValue(new Double(spinner.getValue())); } } }); this.spinWind.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { if (DEBUG) { System.out.println("compassDemo:spinWindPropertyChange"); } final Spinner spinner = (Spinner) evt.getSource(); if (spinner.isEnabled()) { compassData.setValue(new Double(spinner.getValue())); } } }); this.jPanel12.setLayout(this.gridLayout2); this.jPanel2.setBorder(this.titledBorder1); this.jPanel2.setLayout(this.gridBagLayout2); this.jPanel1.setBorder(this.titledBorder2); this.jPanel1.setLayout(this.gridBagLayout1); this.titledBorder1.setTitle("Second Pointer"); this.titledBorder2.setTitle("First Pointer"); this.titledBorder3.setTitle("Plot Options"); this.pick2Pointer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(final ActionEvent e) { pick2PointerActionPerformed(e); } }); this.pick1Pointer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(final ActionEvent e) { pick1PointerActionPerformed(e); } }); add(this.panelCompassHolder, null); this.panelCompassHolder.add(this.jPanel12, BorderLayout.SOUTH); this.jPanel12.add(this.jPanel1, null); this.jPanel1.add(this.pick1Pointer, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); this.jPanel1.add(this.windNullCheckBox, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); this.jPanel1.add(this.spinWind, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); this.jPanel12.add(this.jPanel2, null); this.jPanel2.add(this.pick2Pointer, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); this.jPanel2.add(this.shipNullCheckBox, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); this.jPanel2.add(this.spinShip, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); this.panelCompassHolder.add(this.panelCompass, BorderLayout.CENTER); }
From source file:com.web.vehiclerouting.optaplanner.common.swingui.SolverAndPersistenceFrame.java
private JComponent createQuickOpenPanel(List<Action> quickOpenActionList, List<File> fileList, String title) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); if (fileList.isEmpty()) { JLabel noneLabel = new JLabel("None"); noneLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); panel.add(noneLabel);//w w w . ja va 2 s . com } else { for (File file : fileList) { Action quickOpenAction = new QuickOpenAction(file); quickOpenActionList.add(quickOpenAction); JButton quickOpenButton = new JButton(quickOpenAction); quickOpenButton.setHorizontalAlignment(SwingConstants.LEFT); quickOpenButton.setMargin(new Insets(0, 0, 0, 0)); panel.add(quickOpenButton); } } JScrollPane scrollPane = new JScrollPane(panel); scrollPane.getVerticalScrollBar().setUnitIncrement(25); scrollPane.setMinimumSize(new Dimension(100, 80)); // Size fits into screen resolution 1024*768 scrollPane.setPreferredSize(new Dimension(180, 200)); JPanel titlePanel = new JPanel(new BorderLayout()); titlePanel.add(scrollPane, BorderLayout.CENTER); titlePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createTitledBorder(title))); return titlePanel; }
From source file:edu.ku.brc.specify.plugins.sgr.SGRResultsDisplay.java
/** * @return//from ww w .j a va2 s. c o m */ private DefaultTableCellRenderer getTableCellRenderer() { return new DefaultTableCellRenderer() { @SuppressWarnings("unchecked") @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { // DataObjTableModelRowInfo rowInfo = rowInfoList.get(row); boolean doCenter = false; Object val = value; if (value instanceof Pair<?, ?>) { Pair<Object, Object> pair = (Pair<Object, Object>) value; val = pair.first; doCenter = true; } JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, val, isSelected, hasFocus, row, column); // if (rowInfo.isMainRecord()) // { // lbl.setForeground(Color.WHITE); // lbl.setBackground(Color.BLUE.brighter().brighter()); // // } else // { // lbl.setForeground(model.isSame(column) ? sameColor : Color.BLACK); // lbl.setBackground(Color.WHITE); // } lbl.setHorizontalTextPosition(doCenter ? SwingConstants.CENTER : SwingConstants.LEFT); return lbl; } }; }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDRInputController.java
@Override protected void removeFromDRAnalysis() { List<DoseResponsePair> selectedConditions = getSelectedConditions(); for (DoseResponsePair selectedCondition : selectedConditions) { //only possible to remove if group contains selected condition if (conditionsList.contains(selectedCondition)) { conditionsList.remove(selectedCondition); }/* w ww . j a v a 2 s. c o m*/ } //only make new analysis group if you have not removed all if (!conditionsList.isEmpty()) { doseResponseController.setdRAnalysisGroup(new GenericDoseResponseAnalysisGroup(conditionsList)); doseResponseController.setFirstFitting(true); // populate bottom table with the analysis group slopesTable.setModel(createTableModel(doseResponseController.getdRAnalysisGroup())); slopesTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT)); } else { //otherwise show new empty table slopesTable.setModel(new NonEditableTableModel()); } }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.SingleCellAnalysisController.java
/** * Initialize main view./*from w w w.j av a 2s . c o m*/ */ private void initAnalysisPanel() { // make a new panel analysisPanel = new AnalysisPanel(); //create a ButtonGroup for the radioButtons used for analysis ButtonGroup radioButtonGroup = new ButtonGroup(); radioButtonGroup.add(analysisPanel.getCellTracksRadioButton()); radioButtonGroup.add(analysisPanel.getCellSpeedRadioButton()); radioButtonGroup.add(analysisPanel.getStatisticsRadioButton()); /** * Add action listeners */ // plot the cell tracks analysisPanel.getCellTracksRadioButton().addActionListener((ActionEvent e) -> { // get the layout from the bottom panel and show the appropriate one CardLayout layout = (CardLayout) analysisPanel.getBottomPanel().getLayout(); layout.show(analysisPanel.getBottomPanel(), analysisPanel.getCellTracksPanel().getName()); plotCellTracks(); }); // analysisPanel.getCellSpeedRadioButton().addActionListener((ActionEvent e) -> { // get the layout from the bottom panel and show the appropriate one CardLayout layout = (CardLayout) analysisPanel.getBottomPanel().getLayout(); layout.show(analysisPanel.getBottomPanel(), analysisPanel.getCellSpeedsPanel().getName()); // take care of data and plots here plotData(); }); // go to the statistics analysisPanel.getStatisticsRadioButton().addActionListener((ActionEvent e) -> { // get the layout from the bottom panel and show the appropriate one CardLayout layout = (CardLayout) analysisPanel.getBottomPanel().getLayout(); layout.show(analysisPanel.getBottomPanel(), analysisPanel.getStatisticsParentPanel().getName()); singleCellStatisticsController.updateConditionList(); }); analysisPanel.getCellTracksRadioButton().setSelected(true); AlignedTableRenderer alignedTableRenderer = new AlignedTableRenderer(SwingConstants.LEFT); for (int i = 0; i < analysisPanel.getDataTable().getColumnModel().getColumnCount(); i++) { analysisPanel.getDataTable().getColumnModel().getColumn(i).setCellRenderer(alignedTableRenderer); } analysisPanel.getDataTable().getTableHeader() .setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT)); // add view to parent panel singleCellMainController.getSingleCellAnalysisPanel().getAnalysisParentPanel().add(analysisPanel, gridBagConstraints); }
From source file:edu.ku.brc.af.ui.forms.formatters.UIFormatterListEdtDlg.java
@Override public void createUI() { super.createUI(); CellConstraints cc = new CellConstraints(); // get formatters for field List<UIFieldFormatterIFace> fmtrs = new Vector<UIFieldFormatterIFace>(uiFieldFormatterMgrCache .getFormatterList(fieldInfo.getTableInfo().getClassObj(), fieldInfo.getName())); Collections.sort(fmtrs, new Comparator<UIFieldFormatterIFace>() { public int compare(UIFieldFormatterIFace o1, UIFieldFormatterIFace o2) { return o1.getName().compareTo(o2.getName()); }/* ww w . jav a 2 s . c om*/ }); // table and field titles PanelBuilder tblInfoPB = new PanelBuilder( new FormLayout("r:p,2px,f:p:g", "p,2px,p,2px,p,10px")/*, new FormDebugPanel()*/); String typeStr = fieldInfo.getType(); typeStr = typeStr.indexOf('.') > -1 ? StringUtils.substringAfterLast(fieldInfo.getType(), ".") : typeStr; JLabel tableTitleLbl = createLabel(getResourceString("FFE_TABLE") + ":"); JLabel tableTitleValueLbl = createLabel(fieldInfo.getTableInfo().getTitle()); tableTitleValueLbl.setBackground(Color.WHITE); tableTitleValueLbl.setOpaque(true); JLabel fieldTitleLbl = createLabel(getResourceString("FFE_FIELD") + ":"); JLabel fieldTitleValueLbl = createLabel(fieldInfo.getTitle()); fieldTitleValueLbl.setBackground(Color.WHITE); fieldTitleValueLbl.setOpaque(true); //JLabel fieldTypeLbl = createLabel(getResourceString("FFE_TYPE") + ":"); //JLabel fieldTypeValueLbl = createLabel(typeStr); //fieldTypeValueLbl.setBackground(Color.WHITE); //fieldTypeValueLbl.setOpaque(true); JLabel fieldLengthLbl = createLabel(getResourceString("FFE_LENGTH") + ":"); JLabel fieldLengthValueLbl = createLabel(Integer.toString(fieldInfo.getLength())); fieldLengthValueLbl.setBackground(Color.WHITE); fieldLengthValueLbl.setOpaque(true); int y = 1; tblInfoPB.add(tableTitleLbl, cc.xy(1, y)); tblInfoPB.add(tableTitleValueLbl, cc.xy(3, y)); y += 2; tblInfoPB.add(fieldTitleLbl, cc.xy(1, y)); tblInfoPB.add(fieldTitleValueLbl, cc.xy(3, y)); y += 2; //tblInfoPB.add(fieldTypeLbl, cc.xy(1, y)); //tblInfoPB.add(fieldTypeValueLbl, cc.xy(3, y)); y += 2; tblInfoPB.add(fieldLengthLbl, cc.xy(1, y)); tblInfoPB.add(fieldLengthValueLbl, cc.xy(3, y)); y += 2; DefaultListModel listModel = new DefaultListModel(); // add available formatters for (UIFieldFormatterIFace format : fmtrs) { listModel.addElement(format); } formatList = createList(listModel); formatList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //formatList.setCellRenderer(new FmtListRenderer()); hookFormatListSelectionListener(); hookFormatListMouseListener(); ActionListener deleteListener = new ActionListener() { public void actionPerformed(ActionEvent e) { deleteFormatter(); } }; ActionListener editListener = new ActionListener() { public void actionPerformed(ActionEvent e) { editFormatter((UIFieldFormatter) formatList.getSelectedValue(), false); } }; ActionListener addListener = new ActionListener() { public void actionPerformed(ActionEvent e) { addFormatter(); } }; ActionListener defListener = new ActionListener() { public void actionPerformed(ActionEvent e) { setAsDefFormatter(); } }; dedaPanel = new DefEditDeleteAddPanel(defListener, editListener, deleteListener, addListener, "FFE_DEF", "FFE_EDT", "FFE_DEL", "FFE_ADD"); dedaPanel.getAddBtn().setEnabled(true); PanelBuilder pb = new PanelBuilder(new FormLayout("f:max(250px;p):g", "p,4px,p,2px,f:p:g,4px,p")); y = 1; pb.add(tblInfoPB.getPanel(), cc.xy(1, y)); y += 2; pb.add(createI18NLabel("FFE_AVAILABLE_FORMATS", SwingConstants.LEFT), cc.xy(1, y)); y += 2; pb.add(createScrollPane(formatList), cc.xy(1, y)); y += 2; pb.add(dedaPanel, cc.xy(1, y)); y += 2; pb.setDefaultDialogBorder(); //pb.getPanel().setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); contentPanel = pb.getPanel(); mainPanel.add(contentPanel, BorderLayout.CENTER); okBtn.setEnabled(false); pack(); }
From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java
private void refreshQuickOpenPanel(JPanel panel, List<Action> quickOpenActionList, List<File> fileList) { panel.removeAll();/*from w w w. j av a 2s .co m*/ quickOpenActionList.clear(); if (fileList.isEmpty()) { JLabel noneLabel = new JLabel("None"); noneLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); panel.add(noneLabel); } else { for (File file : fileList) { Action quickOpenAction = new QuickOpenAction(file); quickOpenActionList.add(quickOpenAction); JButton quickOpenButton = new JButton(quickOpenAction); quickOpenButton.setHorizontalAlignment(SwingConstants.LEFT); quickOpenButton.setMargin(new Insets(0, 0, 0, 0)); panel.add(quickOpenButton); } } }