List of usage examples for javax.swing JComponent setLayout
public void setLayout(LayoutManager mgr)
From source file:de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.KgmlEdMain.java
/** * The editor's main method.//from w w w . j ava2s.c om * * @param args * the command line arguments. */ public static void main(String[] args) { GravistoMainHelper.setLookAndFeel(); System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); // System.setProperty("java.net.useSystemProxies","true"); ReleaseInfo.setRunningReleaseStatus(Release.KGML_EDITOR); String stS = "<font><b>"; // "<font color=\"#9500C0\"><b>"; String stE = "</b></font>"; String name = stS + "KGML Pathway Editor" + stE + " - " + "Edit, process and visualize KGML" + DBEgravistoHelper.kgmlFileVersionHint + " pathway files!"; JComponent result = new JPanel(); result.setLayout(TableLayout.getLayout(TableLayoutConstants.FILL, TableLayoutConstants.FILL)); String s = "" + "<html><small><br> </small>Welcome to " + name + "<br>" + "<small>" + " If you experience problems or would like to suggest enhancements, feel free to use the <b>Send feedback command</b> in the Help menu!<br> "; ReleaseInfo.setHelpIntroductionText(s); DBEgravistoHelper.DBE_GRAVISTO_VERSION = "KGML Pathway Editor V" + DBEgravistoHelper.DBE_GRAVISTO_VERSION_CODE; DBEgravistoHelper.DBE_GRAVISTO_NAME = stS + "KGML Pathway Editor" + stE + " - " + "Edit, process, <br>and visualize KGML" + DBEgravistoHelper.kgmlFileVersionHint + " Pathway files!<br>"; DBEgravistoHelper.DBE_GRAVISTO_NAME_SHORT = "KGML Pathway Editor"; DBEgravistoHelper.DBE_INFORMATIONSYSTEM_NAME = ""; AttributeHelper.setMacOSsettings(DBEgravistoHelper.DBE_GRAVISTO_NAME_SHORT); new KgmlEdMain(true, DBEgravistoHelper.DBE_GRAVISTO_VERSION, args); }
From source file:Main.java
public static void uninstallLayout(JComponent c, LayoutManager layout) { if (layout != null && layout == c.getLayout()) { c.setLayout(null); }/*from ww w. java 2 s . c o m*/ }
From source file:de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.MainM.java
public static void startVantedExt(String[] args, String[] developerAddon, String addPluginFile) { System.out.println("Welcome! About to start the application..."); if (SystemInfo.isMac()) { try {/*from w w w . ja va 2 s.c o m*/ OSXAdapter.setFileHandler(new GravistoService(), GravistoService.class.getDeclaredMethod("loadFile", new Class[] { String.class })); } catch (Exception err) { ErrorMsg.addErrorMessage(err); } } System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); // System.setProperty("java.net.useSystemProxies","true"); LoggingProxy ps = new LoggingProxy(ProxySelector.getDefault()); ProxySelector.setDefault(ps); ReleaseInfo.setRunningReleaseStatus(Release.RELEASE_PUBLIC); GravistoMainHelper.setLookAndFeel(); String stS = "<font color=\"#9500C0\"><b>"; String stE = "</b></font>"; String name = stS + "VANTED" + stE + " - " + stS + "V" + stE + "isualization and " + stS + "A" + stE + "nalysis of " + stS + "N" + stE + "e" + stS + "t" + stE + "works <br>containing " + stS + "E" + stE + "xperimental " + stS + "D" + stE + "ata"; JComponent result = new JPanel(); result.setLayout(TableLayout.getLayout(TableLayoutConstants.FILL, TableLayoutConstants.FILL)); String s = "" + "<html><small><br> </small>Welcome to " + name.replaceAll("<br>", "") + "!<br>" + "<small>" + " In the <b>Help menu</b> you find a <b>tutorial section</b> which " + "quickly gives an overview on the various features of this application.<br>" + " Furthermore you will find <b>[?] buttons</b> throughout the " + "system which point directly to topics of interest.<br>" + " If you experience problems or would like to suggest enhancements, " + "feel free to use the <b>Send feedback command</b> in the Help menu!<br> "; if (!ReleaseInfo.getIsAllowedFeature(FeatureSet.GravistoJavaHelp)) s = "" + "<html><small> </small>Welcome to " + name.replaceAll("<br>", "") + "!" + " <font color='gray'>" + DBEgravistoHelper.DBE_GRAVISTO_VERSION_CODE_SUBVERSION + "</small>";// <br>" // + // "<small>" + // " The help functions may be enabled from the side panel <b>Help/Settings</b>.<br>" + // " If you experience problems or would like to suggest enhancements, " + // "feel free to use the <b>Send feedback command</b> in the Help menu!"; ReleaseInfo.setHelpIntroductionText(s); DBEgravistoHelper.DBE_GRAVISTO_VERSION = "VANTED V" + DBEgravistoHelper.DBE_GRAVISTO_VERSION_CODE; DBEgravistoHelper.DBE_GRAVISTO_NAME = stS + "VANTED" + stE + " - " + stS + "V" + stE + "isualization and " + stS + "A" + stE + "nalysis of " + stS + "N" + stE + "e" + stS + "t" + stE + "works <br>containing " + stS + "E" + stE + "xperimental " + stS + "D" + stE + "ata<br>"; DBEgravistoHelper.DBE_GRAVISTO_NAME_SHORT = "VANTED"; DBEgravistoHelper.DBE_INFORMATIONSYSTEM_NAME = ""; AttributeHelper.setMacOSsettings(DBEgravistoHelper.DBE_GRAVISTO_NAME_SHORT); new MainM(true, DBEgravistoHelper.DBE_GRAVISTO_VERSION, args, developerAddon, addPluginFile); }
From source file:cool.pandora.modeller.ui.jpanel.base.OrganizationProfileForm.java
@Override protected JComponent createFormControl() { final JComponent form = new JPanel(); form.setLayout(new BorderLayout()); final JComponent formFields = createFormFields(); form.add(formFields, BorderLayout.CENTER); return form;/* w ww.j av a 2 s . c o m*/ }
From source file:SimpleAuthenticator.java
protected PasswordAuthentication getPasswordAuthentication() { // given a prompt? String prompt = getRequestingPrompt(); if (prompt == null) prompt = "Please login..."; // protocol//from www . ja v a 2 s . co m String protocol = getRequestingProtocol(); if (protocol == null) protocol = "Unknown protocol"; // get the host String host = null; InetAddress inet = getRequestingSite(); if (inet != null) host = inet.getHostName(); if (host == null) host = "Unknown host"; // port String port = ""; int portnum = getRequestingPort(); if (portnum != -1) port = ", port " + portnum + " "; // Build the info string String info = "Connecting to " + protocol + " mail service on host " + host + port; //JPanel d = new JPanel(); // XXX - for some reason using a JPanel here causes JOptionPane // to display incorrectly, so we workaround the problem using // an anonymous JComponent. JComponent d = new JComponent() { }; GridBagLayout gb = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); d.setLayout(gb); c.insets = new Insets(2, 2, 2, 2); c.anchor = GridBagConstraints.WEST; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0.0; d.add(constrain(new JLabel(info), gb, c)); d.add(constrain(new JLabel(prompt), gb, c)); c.gridwidth = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; d.add(constrain(new JLabel("Username:"), gb, c)); c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0; String user = getDefaultUserName(); JTextField username = new JTextField(user, 20); d.add(constrain(username, gb, c)); c.gridwidth = 1; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; c.weightx = 0.0; d.add(constrain(new JLabel("Password:"), gb, c)); c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0; JPasswordField password = new JPasswordField("", 20); d.add(constrain(password, gb, c)); // XXX - following doesn't work if (user != null && user.length() > 0) password.requestFocus(); else username.requestFocus(); int result = JOptionPane.showConfirmDialog(frame, d, "Login", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.OK_OPTION) return new PasswordAuthentication(username.getText(), password.getText()); else return null; }
From source file:com.rapidminer.template.gui.RoleRequirementSelector.java
public RoleRequirementSelector(final TemplateController controller) { super(new BorderLayout()); setBorder(border);/* www. jav a2 s . com*/ this.controller = controller; setBackground(Color.WHITE); updateRequirement(); controller.getModel().addObserver(new Observer() { @Override public void update(Observable o, Object arg) { if (TemplateState.OBSERVER_EVENT_TEMPLATE.equals(arg)) { updateRequirement(); updateComponents(); } else if (TemplateState.OBSERVER_EVENT_ROLES.equals(arg)) { assignSelectionToCombo(); updateComponents(); attributeCombo.repaint(); } else if (TemplateState.OBSERVER_EVENT_INPUT.equals(arg)) { updateAttributes(); } } }); AutoCompleteDecorator.decorate(attributeCombo); AutoCompleteDecorator.decorate(positiveClassCombo); attributeCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (areValuesAdjusting) { return; } assignRoles(); } }); positiveClassCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (areValuesAdjusting) { return; } assignRoles(); } }); helpLabel.setHorizontalAlignment(SwingConstants.CENTER); add(helpLabel, BorderLayout.PAGE_START); chartPanel = new ChartPanel(null, 250, 250, 100, 100, 360, 360, true, false, false, false, false, false); chartPanel.setMinimumDrawWidth(0); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMinimumDrawHeight(0); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); attributeCombo.setPreferredSize(new Dimension(100, 30)); attributeCombo.setMaximumSize(new Dimension(150, 30)); add(chartPanel, BorderLayout.CENTER); JComponent comboPanel = new JPanel(); comboPanel.setLayout(new BoxLayout(comboPanel, BoxLayout.PAGE_AXIS)); JComponent comboPanelAtt = new JPanel(); comboPanelAtt.setBackground(Color.WHITE); comboPanelAtt.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JComponent comboPanelClass = new JPanel(); comboPanelClass.setBackground(Color.WHITE); comboPanelClass.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); positiveClassCombo.setPreferredSize(new Dimension(100, 30)); positiveClassCombo.setMaximumSize(new Dimension(150, 30)); positiveClassLabel.setLabelFor(positiveClassCombo); positiveClassLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); positiveClassLabel.setToolTipText(positiveClassLabel.getText()); positiveClassLabel.setHorizontalAlignment(SwingConstants.RIGHT); columnLabel.setLabelFor(attributeCombo); columnLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); columnLabel.setToolTipText(columnLabel.getText()); columnLabel.setHorizontalAlignment(SwingConstants.RIGHT); comboPanelAtt.add(columnLabel); comboPanelAtt.add(attributeCombo); comboPanelClass.add(positiveClassLabel); comboPanelClass.add(positiveClassCombo); comboPanel.add(comboPanelAtt); comboPanel.add(comboPanelClass); add(comboPanel, BorderLayout.SOUTH); updateComponents(); }
From source file:org.datacleaner.panels.WelcomePanel.java
private JComponent createContentPanel() { JComponent result = null; final String welcomePanelClassName = SystemProperties.getString(SystemProperties.UI_DESKTOP_WELCOME_PANEL, null);// w ww. jav a2 s .co m if (!Strings.isNullOrEmpty(welcomePanelClassName)) { final Injector injector = _dcModule.createInjectorBuilder().with(WelcomePanel.class, this) .createInjector(); try { @SuppressWarnings("unchecked") final Class<? extends JComponent> componentClass = (Class<? extends JComponent>) Class .forName(welcomePanelClassName); result = injector.getInstance(componentClass); } catch (Exception e) { logger.error("Failed to instantiate welcome panel class: {}", welcomePanelClassName, e); } } if (result == null) { result = new DCPanel(); if (Version.isCommunityEdition()) { final JXEditorPane editorPane = new JXEditorPane("text/html", "You're now using the <b>Community Edition</b> of DataCleaner.<br/><br/>" + "We hope that you enjoy this free product. We encourage you to also check out the " + "commercial DataCleaner editions which feature added functionality, " + "helpful getting started wizards and commercial support. " + "You can find more information about them online."); editorPane.setEditable(false); editorPane.setOpaque(false); editorPane.setFont(WidgetUtils.FONT_HEADER2); editorPane.setPreferredSize(new Dimension(DCSplashPanel.WIDTH_CONTENT, 120)); final JButton tryProfessionalButton = WidgetFactory.createDefaultButton("Try professional edition", IconUtils.APPLICATION_ICON); tryProfessionalButton .addActionListener(new OpenBrowserAction("http://datacleaner.org/get_datacleaner")); final JButton readMoreButton = WidgetFactory.createDefaultButton("Compare the editions", IconUtils.WEBSITE); readMoreButton.addActionListener(new OpenBrowserAction("http://datacleaner.org/editions")); final JButton discussionForumButton = WidgetFactory .createDefaultButton("Visit the discussion forum", "images/menu/forum.png"); discussionForumButton.setToolTipText( "Visit the online discussion forum for questions and answers in the community"); final OpenBrowserAction forumActionListener = new OpenBrowserAction("http://datacleaner.org/forum"); discussionForumButton.addActionListener(forumActionListener); final JButton twitterButton = WidgetFactory.createDefaultButton(null, "images/menu/twitter.png"); twitterButton.setToolTipText("Spread the message about #DataCleaner on Twitter"); twitterButton.addActionListener(new OpenBrowserAction("https://twitter.com/intent/tweet?text=" + UrlEscapers.urlFormParameterEscaper().escape("I'm using @DataCleaner (v. " + Version.getVersion() + ") for some really fancy #dataquality stuff!"))); final JButton linkedInButton = WidgetFactory.createDefaultButton(null, "images/menu/linkedin.png"); linkedInButton.setToolTipText("Join our LinkedIn group of users and professionals"); linkedInButton .addActionListener(new OpenBrowserAction("http://www.linkedin.com/groups?gid=3352784")); final JLabel loveFeedbackAnimation = new JLabel( ImageManager.get().getImageIcon("images/window/we_love_community_and_feedback.gif"), JLabel.LEFT); loveFeedbackAnimation.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); loveFeedbackAnimation.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { forumActionListener.actionPerformed(null); } }); final DCPanel innerPanel = new DCPanel(); innerPanel.setLayout(new VerticalLayout()); innerPanel.setBorder( new CompoundBorder(WidgetUtils.BORDER_LIST_ITEM_LEFT_ONLY, new EmptyBorder(0, 20, 0, 0))); innerPanel.add(editorPane); innerPanel.add(DCPanel.flow(tryProfessionalButton, readMoreButton)); innerPanel.add(Box.createVerticalStrut(80)); innerPanel.add(loveFeedbackAnimation); innerPanel.add(Box.createVerticalStrut(20)); innerPanel.add(DCPanel.flow(discussionForumButton, twitterButton, linkedInButton)); innerPanel.add(Box.createVerticalStrut(5)); result.setLayout(new VerticalLayout()); result.add(Box.createVerticalStrut(100)); result.add(innerPanel); } } return wrapContent(result); }
From source file:org.freeplane.view.swing.features.filepreview.AudioViewerFactory.java
public JComponent createViewer(final ExternalResource resource, final URI uri, int maximumWidth) throws MalformedURLException, IOException { String vlcPath = "C:\\Program Files\\VideoLAN\\VLC"; NativeLibrary.addSearchPath("libvlc", vlcPath); System.setProperty("jna.library.path", vlcPath); final URI mediaPath = uri; JComponent jc = new JPanel(); jc.setLayout(new GridLayout(3, 2, 5, 10)); JLabel FileType = new JLabel("FILE TYPE: "); JLabel FileName = new JLabel("AUDIO FILE"); JLabel Title = new JLabel("TITLE: "); tField = new TextField(20); tField.setEditable(true);/*from w w w.jav a 2 s .co m*/ //tField.setText(new Scanner(new File("fieldSave.txt")).useDelimiter("\\A").next()); // JLabel TitleData = new JLabel("________________________"); JButton TitleButton = new JButton("Save Title"); JButton playAudio = new JButton("Play Audio"); jc.add(FileType); jc.add(FileName); jc.add(Title); jc.add(tField); // jc.add(TitleData); jc.add(TitleButton); jc.add(playAudio); playAudio.addActionListener(new PlayAudio(mediaPath, vlcPath)); TitleButton.addActionListener(new AddTitleData()); jc.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); return jc; }
From source file:org.freeplane.view.swing.features.filepreview.VideoViewerFactory.java
public JComponent createViewer(final ExternalResource resource, final URI uri, int maximumWidth) throws MalformedURLException, IOException { String vlcPath = "C:\\Program Files\\VideoLAN\\VLC"; NativeLibrary.addSearchPath("libvlc", vlcPath); System.setProperty("jna.library.path", vlcPath); final URI mediaPath = uri; JComponent jc = new JPanel(); jc.setLayout(new GridLayout(3, 2, 5, 10)); JLabel FileType = new JLabel("FILE TYPE: "); JLabel FileName = new JLabel("VIDEO FILE"); JLabel Title = new JLabel("TITLE: "); tField = new TextField(20); tField.setEditable(true);/* w w w.jav a 2s . co m*/ //tField.setText(new Scanner(new File("fieldSave.txt")).useDelimiter("\\A").next()); // JLabel TitleData = new JLabel("________________________"); JButton TitleButton = new JButton("Save Title"); JButton playVideo = new JButton("Play Video"); jc.add(FileType); jc.add(FileName); jc.add(Title); jc.add(tField); // jc.add(TitleData); jc.add(TitleButton); jc.add(playVideo); playVideo.addActionListener(new PlayAudio(mediaPath, vlcPath)); TitleButton.addActionListener(new AddTitleData()); tField.addActionListener(new AddTitleData()); jc.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); return jc; }
From source file:org.jcurl.demo.smack.JCurlSmackClient.java
@Override protected void startup() { getMainFrame().setJMenuBar(createMenuBar()); miRoster.setSelected(true);//w w w. j a va 2 s . co m final JComponent pv = new JPanel(); pv.setLayout(new BorderLayout()); final Box conversation = Box.createVerticalBox(); pv.add(new JScrollPane(conversation, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); pv.add(new JScrollPane(sca, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.SOUTH); final JSplitPane ph = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); ph.setResizeWeight(0.8); ph.add(pv, JSplitPane.LEFT); ph.add(new JScrollPane(sro), JSplitPane.RIGHT); xmppRoster(); show(ph); // connect the jabber account new Thread(new Runnable() { public void run() { try { // get uid + pwd from a .properties file final Properties p = loadClassProps(JCurlSmackClient.class, null); acc.setUid(XmppAddress.parse(p.getProperty("acc_uid"))); acc.setPwd(p.getProperty("acc_pwd")); // login and get the present buddies acc.login(resource); SwingUtilities.invokeLater(new Runnable() { public void run() { sro.setConn(acc.getConn()); // Wire up xmpp stuff: final ChatManager cm = sro.getChatManager(); cm.addChatListener(sca); cm.addChatListener(slo); } }); } catch (final IOException e) { throw new RuntimeException("Unhandled", e); } catch (final XMPPException e) { throw new RuntimeException("Unhandled", e); } } }).start(); }