List of usage examples for javax.swing JLabel setPreferredSize
@BeanProperty(preferred = true, description = "The preferred size of the component.") public void setPreferredSize(Dimension preferredSize)
From source file:edu.clemson.cs.nestbed.client.gui.MoteConfigPanel.java
public MoteConfigPanel(MoteTestbedAssignment mtbAssignment, ProgramManager programManager, int projDepConfID, MoteManager moteManager, MoteTypeManager moteTypeManager, MoteDeploymentConfigurationManager mdcManager) throws RemoteException, NotBoundException, MalformedURLException { this.programManager = programManager; this.mtbAssignment = mtbAssignment; this.projDepConfID = projDepConfID; this.mote = moteManager.getMote(mtbAssignment.getMoteID()); this.moteType = moteTypeManager.getMoteType(mote.getMoteTypeID()); this.mdcManager = mdcManager; this.moteDepConfig = mdcManager.getMoteDeploymentConfiguration(projDepConfID, mote.getID()); this.radioChangeListener = new RadioChangeListener(); this.radioSpinner = new JSpinner( new SpinnerNumberModel(MAX_RADIO_POWER, MIN_RADIO_POWER, MAX_RADIO_POWER, RADIO_POWER_INCR)); setIcon(new ImageIcon(moteType.getImage()).getImage()); if (this.moteDepConfig != null) { this.program = programManager.getProgram(moteDepConfig.getProgramID()); radioSpinner.setValue(moteDepConfig.getRadioPowerLevel()); } else {/* ww w . java2s. com*/ radioSpinner.setEnabled(false); } radioSpinner.setToolTipText("Radio Power Level"); Dimension labelSize = new Dimension(LABEL_WIDTH, LABEL_HEIGHT); JLabel addressLabel = new JLabel("" + mtbAssignment.getMoteAddress()); addressLabel.setSize(labelSize); addressLabel.setPreferredSize(labelSize); Dimension spinnerSize = new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT); radioSpinner.setSize(spinnerSize); radioSpinner.setPreferredSize(spinnerSize); radioSpinner.addChangeListener(radioChangeListener); setToolTipText(getToolTipString()); addMouseListener(new MotePanelMouseListener()); add(addressLabel); addressLabel.setLocation(2, 0); add(radioSpinner); radioSpinner.setLocation(getWidth() - SPINNER_WIDTH - 2, getHeight() - SPINNER_HEIGHT - 2); mdcManager.addRemoteObserver(new MoteDeploymentConfigObserver()); new DropTarget(this, DnDConstants.ACTION_COPY_OR_MOVE, new ProgramDropTarget(), true); }
From source file:de.tor.tribes.ui.components.DatePicker.java
private void init() { //build Header for (int i = 0; i < 7; i++) { JLabel head = new JLabel(dayNames[i]); head.setBackground(GRAY);//from w ww . j av a2 s . co m head.setOpaque(true); head.setPreferredSize(new Dimension(20, 20)); head.setMinimumSize(new Dimension(20, 20)); head.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.PAGE_START; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = i; gbc.gridy = 0; gbc.insets = new Insets(2, 2, 6, 2); gbc.ipadx = 0; gbc.ipady = 0; gbc.weightx = 1.0; gbc.weighty = 0.0; jPanelDaySelection.add(head, gbc); } daysInMonth = new CrossedLabel[WEEKS_TO_SHOW][7]; datesInMonth = new Date[WEEKS_TO_SHOW][7]; for (int i = 0; i < WEEKS_TO_SHOW; i++) { for (int j = 0; j < 7; j++) { daysInMonth[i][j] = new CrossedLabel(); daysInMonth[i][j].setPreferredSize(new Dimension(20, 20)); daysInMonth[i][j].setMinimumSize(new Dimension(20, 20)); daysInMonth[i][j].setHorizontalAlignment(javax.swing.SwingConstants.CENTER); daysInMonth[i][j].addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent mouseevent) { dayClicked(mouseevent); } }); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.PAGE_START; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = j; gbc.gridy = i + 1; gbc.insets = new Insets(2, 2, 2, 2); gbc.ipadx = 0; gbc.ipady = 0; gbc.weightx = 1.0; gbc.weighty = 0.0; jPanelDaySelection.add(daysInMonth[i][j], gbc); } } buildCalendar(); }
From source file:net.sf.jabref.importer.fetcher.ACMPortalFetcher.java
private boolean getNextEntryURL(String allText, int entryNumber, Map<String, JLabel> entries) { int index = allText.indexOf(NEXT_ENTRY_PATTERN, piv); int endIndex = allText.indexOf(END_ENTRY_PATTERN, index); piv = endIndex;//from www . j av a 2 s . c o m if (index >= 0) { String text = allText.substring(index, endIndex); // Always try RIS import first Matcher fullCitation = ACMPortalFetcher.FULL_CITATION_PATTERN.matcher(text); String item; if (fullCitation.find()) { String link = getEntryBibTeXURL(fullCitation.group(1)); if (endIndex > 0) { StringBuilder sb = new StringBuilder(); // Find authors: int authStart = text.indexOf(AUTHOR_MARKER); if (authStart >= 0) { int authEnd = text.indexOf("</div>", authStart + AUTHOR_MARKER.length()); if (authEnd >= 0) { sb.append("<p>").append(text.substring(authStart, authEnd)).append("</p>"); } } // Find title: Matcher titM = ACMPortalFetcher.TITLE_PATTERN.matcher(text); if (titM.find()) { sb.append("<p>").append(titM.group(1)).append("</p>"); } int sourceStart = text.indexOf(SOURCE_MARKER); if (sourceStart >= 0) { int sourceEnd = text.indexOf("</div>", sourceStart + SOURCE_MARKER.length()); if (sourceEnd >= 0) { String sourceText = text.substring(sourceStart, sourceEnd); // Find source: Matcher source = ACMPortalFetcher.SOURCE_PATTERN.matcher(sourceText); if (source.find()) { sb.append("<p>").append(source.group(1)).append("</p>"); } } } item = sb.toString(); } else { item = link; } JLabel preview = new JLabel("<html>" + item + "</html>"); preview.setPreferredSize(new Dimension(750, 100)); entries.put(link, preview); return true; } LOGGER.warn("Citation unmatched " + Integer.toString(entryNumber)); return false; } return false; }
From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java
/** * Creates the UI panel containing all of the fields necessary to upload * the current session data to the web service *//*from w ww . ja v a2 s. com*/ private void createSetupPane() { this.setupPanel = new JPanel(); this.setupPanel.setLayout(new BorderLayout()); this.setupPanel.setBackground(Color.white); try { String data = IOUtils.toString(LoginDialog.class.getResourceAsStream("/export2.html")); data = data.replace("{LIST}", formatWitnessList()); JLabel txt = new JLabel(data); this.setupPanel.add(txt, BorderLayout.NORTH); } catch (IOException e) { // dunno. not much that can be done! } // ugly layout code to follow. avert your eyes JPanel data = new JPanel(); data.setLayout(new BorderLayout()); data.setBackground(Color.white); JPanel names = new JPanel(); names.setLayout(new BoxLayout(names, BoxLayout.Y_AXIS)); names.setBackground(Color.white); JLabel l = new JLabel("Name:", SwingConstants.RIGHT); l.setPreferredSize(new Dimension(100, 20)); l.setMaximumSize(new Dimension(100, 20)); l.setAlignmentX(RIGHT_ALIGNMENT); names.add(l); names.add(Box.createVerticalStrut(5)); JLabel l2 = new JLabel("Description:", SwingConstants.RIGHT); l2.setPreferredSize(new Dimension(100, 20)); l2.setMaximumSize(new Dimension(100, 20)); l2.setAlignmentX(RIGHT_ALIGNMENT); names.add(l2); data.add(names, BorderLayout.WEST); JPanel edits = new JPanel(); edits.setBackground(Color.white); edits.setLayout(new BoxLayout(edits, BoxLayout.Y_AXIS)); this.nameEdit = new JTextField(); this.nameEdit.setPreferredSize(new Dimension(200, 22)); this.nameEdit.setMaximumSize(new Dimension(200, 22)); File saveFile = this.juxtaFrame.getSession().getSaveFile(); if (saveFile == null) { this.nameEdit.setText("new_session"); } else { String name = saveFile.getName(); this.nameEdit.setText(name.substring(0, name.lastIndexOf('.'))); } edits.add(this.nameEdit); this.descriptionEdit = new JTextArea(3, 0); this.descriptionEdit.setLineWrap(true); this.descriptionEdit.setWrapStyleWord(true); JScrollPane sp = new JScrollPane(this.descriptionEdit); sp.setPreferredSize(new Dimension(194, 60)); sp.setMaximumSize(new Dimension(194, 300)); edits.add(Box.createVerticalStrut(4)); edits.add(sp); data.add(edits, BorderLayout.CENTER); this.setupPanel.add(data, BorderLayout.SOUTH); }
From source file:hr.fer.zemris.vhdllab.platform.gui.dialog.save.SaveDialog.java
public SaveDialog(LocalizationSource source, SaveContext context) { super(source); Validate.notNull(context, "Save variant can't be null"); // setup label JLabel label = new JLabel(getMainMessage(source, context)); int width = DIALOG_WIDTH - 2 * BORDER; int height = LABEL_HEIGHT - 2 * BORDER; label.setPreferredSize(new Dimension(width, height)); label.setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER)); // setup check box list list = new CheckBoxList(); width = DIALOG_WIDTH - 2 * BORDER;/* w ww . ja v a 2 s. c om*/ height = 0; // because list is a center component and it doesnt need // height list.setPreferredSize(new Dimension(width, height)); list.setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER)); // setup select all and deselect all buttons JButton selectAll = new JButton(source.getMessage(SELECT_ALL_MESSAGE)); selectAll.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT)); selectAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { list.setSelectionToAll(true); } }); JButton deselectAll = new JButton(source.getMessage(DESELECT_ALL_MESSAGE)); deselectAll.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT)); deselectAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { list.setSelectionToAll(false); } }); Box selectBox = Box.createHorizontalBox(); selectBox.add(selectAll); selectBox.add(Box.createRigidArea(new Dimension(BORDER, BUTTON_HEIGHT))); selectBox.add(deselectAll); selectBox.setBorder(BorderFactory.createEmptyBorder(0, 0, BORDER, 0)); // setup ok and cancel buttons JButton ok = new JButton(source.getMessage(OK_MESSAGE)); ok.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT)); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { closeDialog(new ArrayList<File>()); } }); JButton cancel = new JButton(source.getMessage(CANCEL_MESSAGE)); cancel.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT)); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { closeDialog(null); } }); Box actionBox = Box.createHorizontalBox(); actionBox.add(ok); actionBox.add(Box.createRigidArea(new Dimension(BORDER, BUTTON_HEIGHT))); actionBox.add(cancel); actionBox.setBorder(BorderFactory.createEmptyBorder(BORDER, 0, BORDER, 0)); JPanel selectPanel = new JPanel(new BorderLayout()); selectPanel.add(selectBox, BorderLayout.EAST); JPanel actionPanel = new JPanel(new BorderLayout()); actionPanel.add(actionBox, BorderLayout.EAST); JCheckBox alwaysSave = new JCheckBox(source.getMessage(ALWAYS_SAVE_MESSAGE)); alwaysSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JCheckBox checkBox = (JCheckBox) e.getSource(); Preferences preferences = Preferences.userNodeForPackage(SaveDialog.class); preferences.putBoolean(SHOULD_AUTO_SAVE, checkBox.isSelected()); } }); alwaysSave.setSelected(false); JPanel alwaysSavePanel = new JPanel(new BorderLayout()); alwaysSavePanel.add(alwaysSave, BorderLayout.WEST); JPanel lowerPanel = new JPanel(new BorderLayout()); lowerPanel.add(selectPanel, BorderLayout.NORTH); lowerPanel.add(alwaysSavePanel, BorderLayout.CENTER); lowerPanel.add(actionPanel, BorderLayout.SOUTH); this.setLayout(new BorderLayout()); JPanel messagePanel = new JPanel(new BorderLayout()); messagePanel.add(label, BorderLayout.NORTH); messagePanel.add(list, BorderLayout.CENTER); messagePanel.add(lowerPanel, BorderLayout.SOUTH); this.getContentPane().add(messagePanel, BorderLayout.CENTER); this.getRootPane().setDefaultButton(ok); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setTitle(getTitle(source, context)); }
From source file:edu.clemson.cs.nestbed.client.gui.MoteManagementPanel.java
public MoteManagementPanel(MoteTestbedAssignment mtbAssignment, ProgramManager programManager, int projDepConfID, MoteManager moteManager, MoteTypeManager moteTypeManager, MoteDeploymentConfigurationManager mdcManager) throws RemoteException, NotBoundException, MalformedURLException { lookupRemoteManagers();//from w w w. j a va 2 s .c o m this.programManager = programManager; this.mtbAssignment = mtbAssignment; this.projDepConfID = projDepConfID; this.mote = moteManager.getMote(mtbAssignment.getMoteID()); this.moteType = moteTypeManager.getMoteType(mote.getMoteTypeID()); this.mdcManager = mdcManager; this.moteDepConfig = mdcManager.getMoteDeploymentConfiguration(projDepConfID, mote.getID()); setIcon(new ImageIcon(moteType.getImage()).getImage()); if (this.moteDepConfig != null) { this.program = programManager.getProgram(moteDepConfig.getProgramID()); } Dimension labelSize = new Dimension(LABEL_WIDTH, LABEL_HEIGHT); JLabel addressLabel = new JLabel("" + mtbAssignment.getMoteAddress()); addressLabel.setSize(labelSize); addressLabel.setPreferredSize(labelSize); setToolTipText(getToolTipString()); addMouseListener(new MotePanelMouseListener()); add(addressLabel); addressLabel.setLocation(2, 0); progDeployMgr.addRemoteObserver(new ProgramInstallationObserver()); mdcManager.addRemoteObserver(new MoteDeploymentConfigObserver()); }
From source file:net.sf.firemox.ui.wizard.About.java
/** * Creates a new instance of About <br> * /* ww w. j a v a 2s . c o m*/ * @param parent */ public About(JFrame parent) { super(LanguageManager.getString("wiz_about.title"), LanguageManager.getString("wiz_about.description"), "mp64.gif", LanguageManager.getString("close"), 420, 620); JPanel thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setMaximumSize(new Dimension(32767, 26)); thanksPanel.setOpaque(false); JLabel jLabel5 = new JLabel(LanguageManager.getString("version") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLabel(IdConst.VERSION); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); JPanel thanksPanelLeft = new JPanel(new FlowLayout(FlowLayout.LEADING)); thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS)); thanksPanelLeft.setMaximumSize(new Dimension(100, 2000)); thanksPanelLeft.setMinimumSize(new Dimension(100, 16)); jLabel5 = new JLabel(LanguageManager.getString("thanks") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanelLeft.add(jLabel5); thanksPanel.add(thanksPanelLeft); thanksPanelLeft = new JPanel(); thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS)); StringBuilder contributors = new StringBuilder(); addContributor(contributors, "Fabrice Daugan", "developper", "france"); addContributor(contributors, "Hoani Cross", "developper", "frenchpolynesia"); addContributor(contributors, "nico100", "graphist", "france"); addContributor(contributors, "seingalt_tm", "graphist", "france"); addContributor(contributors, "surtur2", "tester", null); addContributor(contributors, "Jan Blaha", "developper", "cz"); addContributor(contributors, "Tureba", "developper", "brazil"); addContributor(contributors, "hakvf", "tester", "france"); addContributor(contributors, "Stefano \"Kismet\" Lenzi", "developper", "italian"); jLabel5 = new JLabel(contributors.toString()); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.LEFT); thanksPanelLeft.add(jLabel5); jLabel5 = new JLink("http://obsidiurne.free.fr", "morgil has designed the splash screen"); jLabel5.setFont(MToolKit.defaultFont); thanksPanelLeft.add(jLabel5); thanksPanel.add(thanksPanelLeft); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setMaximumSize(new Dimension(32767, 26)); thanksPanel.setOpaque(false); JLabel blanklbl = new JLabel(); blanklbl.setHorizontalAlignment(SwingConstants.RIGHT); blanklbl.setMaximumSize(new Dimension(100, 16)); blanklbl.setMinimumSize(new Dimension(100, 16)); blanklbl.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(blanklbl); jLabel5 = new JLink( "http://sourceforge.net/tracker/?func=add&group_id=" + IdConst.PROJECT_ID + "&atid=601043", LanguageManager.getString("joindev")); jLabel5.setFont(MToolKit.defaultFont); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); jLabel5 = new JLabel(LanguageManager.getString("projecthome") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLink(IdConst.MAIN_PAGE, IdConst.MAIN_PAGE); jLabel5.setFont(MToolKit.defaultFont); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); // forum francais thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); jLabel5 = new JLabel(LanguageManager.getString("othersites") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLink("http://www.Firemox.fr.st", UIHelper.getIcon("mpfrsml.gif"), SwingConstants.LEFT); jLabel5.setToolTipText(LanguageManager.getString("frenchforum.tooltip")); thanksPanel.add(jLabel5); jLabel5 = new JLabel(); jLabel5.setMaximumSize(new Dimension(1000, 16)); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); JTextArea disclaimer = new JTextArea(); disclaimer.setEditable(false); disclaimer.setLineWrap(true); disclaimer.setWrapStyleWord(true); disclaimer.setAutoscrolls(true); disclaimer.setTabSize(2); disclaimer.setFont(new Font("Arial", 0, 10)); // Then try and read it locally BufferedReader inGPL = null; try { inGPL = new BufferedReader(new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_LICENSE))); disclaimer.read(inGPL, ""); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(inGPL); } JScrollPane disclaimerSPanel = new JScrollPane(); disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); MToolKit.addOverlay(disclaimerSPanel); disclaimerSPanel.setViewportView(disclaimer); gameParamPanel.add(disclaimerSPanel); }
From source file:inet.CalculationNetworkEditor.visual.view.EditorPane.java
private void addContentToStackingVertexPanel(JPanel rightPanel, V v, Collection<V> allPhysicalCol) { //caption//from w ww. j a v a 2 s.c om JLabel caption = new JLabel("Map: " + v); caption.setSize(new Dimension(180, 20)); caption.setPreferredSize(new Dimension(180, 20)); rightPanel.add(caption, BorderLayout.NORTH); //to JPanel toPanel = new JPanel(); toPanel.setLayout(new BorderLayout()); rightPanel.add(toPanel, BorderLayout.CENTER); JLabel to = new JLabel("To:"); to.setSize(new Dimension(180, 20)); to.setPreferredSize(new Dimension(180, 20)); toPanel.add(to, BorderLayout.NORTH); //all physical JComboBox allPhysicalVertexJCB = new JComboBox<V>(); for (V vert : allPhysicalCol) { allPhysicalVertexJCB.addItem(vert); } JPanel allPhysicalPanel = new JPanel(); toPanel.add(allPhysicalPanel, BorderLayout.CENTER); allPhysicalPanel.setLayout(new BorderLayout()); allPhysicalPanel.add(allPhysicalVertexJCB, BorderLayout.NORTH); allPhysicalVertexJCB.setSize(new Dimension(180, 20)); allPhysicalVertexJCB.setPreferredSize(new Dimension(180, 20)); // JButton stack JButton stack = new JButton("map"); stack.addActionListener(editingPanelsListener); rightPanel.add(stack, BorderLayout.SOUTH); }
From source file:com.googlecode.logVisualizer.LogVisualizer.java
private LogVisualizer() { try {/* w w w . jav a 2 s .c o m*/ final String wantedLaf = Settings.getSettingString("LookAndFeel"); LookAndFeelInfo usedLaf = null; for (final LookAndFeelInfo lafi : UIManager.getInstalledLookAndFeels()) if (lafi.getName().equals(wantedLaf)) { usedLaf = lafi; break; } if (usedLaf != null) UIManager.setLookAndFeel(usedLaf.getClassName()); else UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (final Exception e) { e.printStackTrace(); } gui = new LogVisualizerGUI(new LogLoaderListener() { public void loadMafiaLog(final File file) { loadLog(file, new MafiaLogParser(file, Settings.getSettingBoolean("Include mafia log notes"))); } public void loadPreparsedLog(final File file) { loadLog(file, new PreparsedLogParser(file)); } public void loadXMLLog(final File file) { try { final LogDataHolder logData = XMLLogReader.parseXMLLog(file); addLogGUI(file, logData); } catch (final FileAccessException e) { e.printStackTrace(); JOptionPane.showMessageDialog(gui, "A problem occurred while reading the file.", "Error occurred", JOptionPane.ERROR_MESSAGE); } catch (final XMLAccessException e) { e.printStackTrace(); JOptionPane.showMessageDialog(gui, "A problem occurred while parsing the XML.", "Error occurred", JOptionPane.ERROR_MESSAGE); } } }); gui.setSize(800, 600); RefineryUtilities.centerFrameOnScreen(gui); gui.setVisible(true); if (Settings.getSettingBoolean("First program startup")) { final JLabel text = new JLabel( "<html>Note that <b>for the purpose of logging your own runs with KolMafia, it is best</b> to " + "turn on all options but <i>Log adventures left instead of adventures used</i> under " + "<i>General->Preferences->Session Logs</i> in KolMafia." + "<br><br><br>This informational popup will only be displayed this once.</html>"); text.setPreferredSize(new Dimension(550, 100)); JOptionPane.showMessageDialog(gui, text, "KolMafia logging options", JOptionPane.INFORMATION_MESSAGE); Settings.setSettingBoolean("First program startup", false); } if (Settings.getSettingBoolean("Check Updates")) new Thread(new Runnable() { public void run() { if (ProjectUpdateViewer.isNewerVersionUploaded()) EventQueue.invokeLater(new Runnable() { public void run() { UpdateDialog.showDialog(gui); } }); } }).start(); }
From source file:inet.CalculationNetworkEditor.visual.view.EditorPane.java
private void addContentToStackingEdgePanel(JPanel rightPanel, E e, Collection<E> allPhysicalCol) { //caption/*from w w w.j a v a 2s.co m*/ JLabel caption = new JLabel("Map: " + e); caption.setSize(new Dimension(180, 20)); caption.setPreferredSize(new Dimension(180, 20)); rightPanel.add(caption, BorderLayout.NORTH); //to JPanel toPanel = new JPanel(); toPanel.setLayout(new BorderLayout()); rightPanel.add(toPanel, BorderLayout.CENTER); JLabel to = new JLabel("To:"); to.setSize(new Dimension(180, 20)); to.setPreferredSize(new Dimension(180, 20)); toPanel.add(to, BorderLayout.NORTH); // buttons edge button panel JPanel buttonsEdgePanel = new JPanel(); buttonsEdgePanel.setLayout(new BorderLayout()); toPanel.add(buttonsEdgePanel, BorderLayout.CENTER); // path listPanel //JPanel pathListPanel = new JPanel(); //pathListPanel.setLayout(new BorderLayout); defaultListModel = new DefaultListModel<E>(); pathList = new JList<E>(defaultListModel); pathList.setSize(180, 100); pathList.setPreferredSize(new Dimension(180, 100)); buttonsEdgePanel.add(pathList, BorderLayout.CENTER); // add remove edge button panel JPanel addRemoveEdgePanel = new JPanel(); addRemoveEdgePanel.setLayout(new BorderLayout()); buttonsEdgePanel.add(addRemoveEdgePanel, BorderLayout.SOUTH); // add Button JButton addButton = new JButton("add"); addRemoveEdgePanel.add(addButton, BorderLayout.LINE_START); addButton.addActionListener(editingPanelsListener); addButton.setSize(new Dimension(70, 20)); addButton.setPreferredSize(new Dimension(70, 20)); // remove Button JButton removeButton = new JButton("remove"); addRemoveEdgePanel.add(removeButton, BorderLayout.LINE_END); removeButton.addActionListener(editingPanelsListener); removeButton.setSize(new Dimension(90, 20)); removeButton.setPreferredSize(new Dimension(90, 20)); // add drop done box with all physical edges allPhysicalEdgeJCB = new JComboBox<E>(); for (E edge : allPhysicalCol) { if (!defaultListModel.contains(edge)) { allPhysicalEdgeJCB.addItem(edge); } } toPanel.add(allPhysicalEdgeJCB, BorderLayout.SOUTH); allPhysicalEdgeJCB.setSize(new Dimension(180, 30)); allPhysicalEdgeJCB.setPreferredSize(new Dimension(180, 30)); allPhysicalEdgeJCB.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); // JButton stack JButton stack = new JButton("map"); stack.addActionListener(editingPanelsListener); rightPanel.add(stack, BorderLayout.SOUTH); }