List of usage examples for javax.swing JLabel setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:net.java.sip.communicator.gui.AuthenticationSplash.java
/** * * We use dynamic layout managers, so that layout is dynamic and will * adapt properly to user-customized fonts and localized text. The * GridBagLayout makes it easy to line up components of varying * sizes along invisible vertical and horizontal grid lines. It * is important to sketch the layout of the interface and decide * on the grid before writing the layout code. * * Here we actually use/*from w w w. java 2 s. c o m*/ * our own subclass of GridBagLayout called StringGridBagLayout, * which allows us to use strings to specify constraints, rather * than having to create GridBagConstraints objects manually. * * * We use the JLabel.setLabelFor() method to connect * labels to what they are labeling. This allows mnemonics to work * and assistive to technologies used by persons with disabilities * to provide much more useful information to the user. */ private void initComponents(final Frame parent) { Container contents = getContentPane(); contents.setLayout(new BorderLayout()); String title = Utils.getProperty("net.java.sip.communicator.gui.AUTH_WIN_TITLE"); if (title == null) title = "Login Manager"; setTitle(title); setResizable(false); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { dialogDone(CMD_CANCEL, parent); } }); // Accessibility -- all frames, dialogs, and applets should // have a description getAccessibleContext().setAccessibleDescription("Authentication Splash"); String authPromptLabelValue = Utils.getProperty("net.java.sip.communicator.gui.AUTHENTICATION_PROMPT"); if (authPromptLabelValue == null) authPromptLabelValue = "Please register to the service or enter your credentials to log in:"; JLabel splashLabel = new JLabel(authPromptLabelValue); splashLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); splashLabel.setHorizontalAlignment(SwingConstants.CENTER); splashLabel.setHorizontalTextPosition(SwingConstants.CENTER); contents.add(splashLabel, BorderLayout.NORTH); JPanel centerPane = new JPanel(); centerPane.setLayout(new GridBagLayout()); userNameTextField = new JTextField(); // needed below // user name label JLabel userNameLabel = new JLabel(); userNameLabel.setDisplayedMnemonic('U'); // setLabelFor() allows the mnemonic to work userNameLabel.setLabelFor(userNameTextField); String userNameLabelValue = Utils.getProperty("net.java.sip.communicator.gui.USER_NAME_LABEL"); if (userNameLabelValue == null) userNameLabelValue = "Username"; int gridy = 0; userNameLabel.setText(userNameLabelValue); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(12, 12, 0, 0); centerPane.add(userNameLabel, c); // user name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(12, 7, 0, 11); centerPane.add(userNameTextField, c); passwordTextField = new JPasswordField(); //needed below // password label JLabel passwordLabel = new JLabel(); passwordLabel.setDisplayedMnemonic('P'); passwordLabel.setLabelFor(passwordTextField); String pLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.PASSWORD_LABEL"); if (pLabelStr == null) pLabelStr = "Password"; passwordLabel.setText(pLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(passwordLabel, c); // password text passwordTextField.setEchoChar('\u2022'); c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(passwordTextField, c); //Set a relevant realm value //Bug report by Steven Lass (sltemp at comcast.net) //JLabel realmValueLabel = new JLabel("SipPhone.com"); // needed below // realm label JLabel realmLabel = new JLabel(); realmLabel.setDisplayedMnemonic('R'); realmLabel.setLabelFor(realmValueLabel); realmLabel.setText("Realm"); realmValueLabel = new JLabel(); // Buttons along bottom of window JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, 0)); loginButton = new JButton(); loginButton.setText("Login"); loginButton.setActionCommand(CMD_LOGIN); loginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(loginButton); // space buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); registerButton = new JButton(); registerButton.setMnemonic('G'); registerButton.setText("Register"); registerButton.setActionCommand(CMD_REGISTER); registerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(registerButton); buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); cancelButton = new JButton(); cancelButton.setText("Cancel"); cancelButton.setActionCommand(CMD_CANCEL); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(cancelButton); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 3; c.gridwidth = 2; c.insets = new Insets(11, 12, 11, 11); centerPane.add(buttonPanel, c); contents.add(centerPane, BorderLayout.CENTER); getRootPane().setDefaultButton(loginButton); equalizeButtonSizes(); setFocusTraversalPolicy(new FocusTraversalPol()); }
From source file:net.sf.jabref.openoffice.StyleSelectDialog.java
private void displayDefaultStyle(boolean authoryear) { try {//from ww w. j av a 2s .co m // Read the contents of the default style file: URL defPath = authoryear ? JabRef.class.getResource(OpenOfficePanel.DEFAULT_AUTHORYEAR_STYLE_PATH) : JabRef.class.getResource(OpenOfficePanel.DEFAULT_NUMERICAL_STYLE_PATH); BufferedReader r = new BufferedReader(new InputStreamReader(defPath.openStream())); String line; StringBuilder sb = new StringBuilder(); while ((line = r.readLine()) != null) { sb.append(line); sb.append('\n'); } // Make a dialog box to display the contents: final JDialog dd = new JDialog(diag, Localization.lang("Default style"), true); JLabel header = new JLabel( "<html>" + Localization.lang("The panel below shows the definition of the default style.") //+"<br>" + Localization.lang( "If you want to use it as a template for a new style, you can copy the contents into a new .jstyle file") + "</html>"); header.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); dd.getContentPane().add(header, BorderLayout.NORTH); JTextArea ta = new JTextArea(sb.toString()); ta.setEditable(false); JScrollPane sp = new JScrollPane(ta); sp.setPreferredSize(new Dimension(700, 500)); dd.getContentPane().add(sp, BorderLayout.CENTER); JButton okButton = new JButton(Localization.lang("OK")); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addButton(okButton); bb.addGlue(); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); dd.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { dd.dispose(); } }); dd.pack(); dd.setLocationRelativeTo(diag); dd.setVisible(true); } catch (IOException ex) { LOGGER.warn("Problem showing default style", ex); } }
From source file:net.schweerelos.parrot.ui.GraphViewComponent.java
@SuppressWarnings("serial") private void setupRenderContext(final VisualizationViewer<NodeWrapper, NodeWrapper> vis) { vis.setRenderer(new ParrotGraphRenderer()); vis.setPickSupport(new ParrotPickSupport(vis)); RenderContext<NodeWrapper, NodeWrapper> renderContext = vis.getRenderContext(); final PickedInfo<NodeWrapper> vertexPickInfo = vis.getPickedVertexState(); final PickedState<NodeWrapper> edgePickInfo = vis.getPickedEdgeState(); // hide all edge arrows except for those on outgoing edges of picked // nodes//from w ww . java 2 s . c om renderContext.setEdgeArrowPredicate(new Predicate<Context<Graph<NodeWrapper, NodeWrapper>, NodeWrapper>>() { @Override public boolean evaluate(Context<Graph<NodeWrapper, NodeWrapper>, NodeWrapper> context) { NodeWrapper edge = context.element; NodeWrapper source = graph.getSource(edge); return vertexPickInfo.isPicked(source); } }); // make edges straight lines to collapse parallel edges renderContext.setEdgeShapeTransformer(new EdgeShape.Line<NodeWrapper, NodeWrapper>()); // hide text of all edges except for outgoing edges of picked nodes renderContext.setEdgeLabelTransformer(new Transformer<NodeWrapper, String>() { @Override public String transform(NodeWrapper edge) { NodeWrapper source = graph.getSource(edge); NodeWrapper destination = graph.getDest(edge); if (vertexPickInfo.isPicked(source) && !vertexPickInfo.isPicked(destination)) { return edge.toString(); } else { return ""; } } }); renderContext.setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(COLOR_EDGE_LABEL) { @Override public <E> Component getEdgeLabelRendererComponent(JComponent vv, Object value, Font font, boolean isSelected, E edge) { Component component = super.getEdgeLabelRendererComponent(vv, value, font, isSelected, edge); component.setForeground(COLOR_EDGE_LABEL); return component; } }); // start from VertexLabelAsShapeDemo // this class will provide both label drawing and vertex shapes VertexLabelAsShapeRenderer<NodeWrapper, NodeWrapper> vlasr = new VertexLabelAsShapeRenderer<NodeWrapper, NodeWrapper>( renderContext); renderContext.setVertexShapeTransformer(vlasr); vis.setForeground(COLOR_NODE_TEXT); // customize the render context renderContext.setVertexLabelTransformer(new ToStringLabeller<NodeWrapper>()); renderContext.setVertexLabelRenderer(new DefaultVertexLabelRenderer(COLOR_NODE_PICKED_TEXT) { @Override public <V> Component getVertexLabelRendererComponent(JComponent vv, Object value, Font font, boolean isSelected, V vertexToRender) { Component component = super.getVertexLabelRendererComponent(vv, value, font, isSelected, vertexToRender); if (component instanceof JLabel) { JLabel label = (JLabel) component; // add a little bit of padding around the text Border originalBorder = label.getBorder(); label.setBorder(BorderFactory.createCompoundBorder(originalBorder, BorderFactory.createEmptyBorder(3, 2, 4, 2))); } // now set the colour/font too if (vertexToRender instanceof NodeWrapper) { NodeWrapper vertex = (NodeWrapper) vertexToRender; if (vertexPickInfo.isPicked(vertex)) { component.setForeground(COLOR_NODE_PICKED_TEXT); } else if (vertex.isHighlighted()) { component.setForeground(COLOR_NODE_HIGHLIGHTED_TEXT); component.setFont(font.deriveFont(Font.BOLD)); } else if (GraphViewHelper.hasPickedNeighbour(vertex, vertexPickInfo, graph)) { component.setForeground(COLOR_NODE_WITH_PICKED_NEIGHBOUR_TEXT); } else if (GraphViewHelper.hasPickedAdjacentEdge(vertex, edgePickInfo, graph)) { component.setForeground(COLOR_NODE_ADJACENT_EDGE_PICKED_TEXT); } else if (GraphViewHelper.hasHighlightedNeighbour(vertex, graph)) { component.setForeground(COLOR_NODE_WITH_HIGHLIGHTED_NEIGHBOUR_TEXT); } else { component.setForeground(COLOR_NODE_TEXT); } } return component; } }); // end from VertexLabelAsShapeDemo vis.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vis.setVertexToolTipTransformer(new Transformer<NodeWrapper, String>() { @Override public String transform(NodeWrapper vertex) { return vertex.getToolTipText(model); } }); // inspired by PluggableRendererDemo Transformer<NodeWrapper, Paint> vertexOutline = new Transformer<NodeWrapper, Paint>() { @Override public Paint transform(NodeWrapper vertex) { if (vertexPickInfo.isPicked(vertex)) { return COLOR_NODE_PICKED_BORDER; } else if (vertex.isHighlighted()) { return COLOR_NODE_HIGHLIGHTED_BORDER; } else { if (GraphViewHelper.hasPickedAdjacentEdge(vertex, edgePickInfo, graph)) { return COLOR_NODE_ADJACENT_EDGE_PICKED_BORDER; } if (GraphViewHelper.hasPickedNeighbour(vertex, vertexPickInfo, graph)) { return COLOR_NODE_WITH_PICKED_NEIGHBOUR_BORDER; } else if (GraphViewHelper.hasHighlightedNeighbour(vertex, graph)) { return COLOR_NODE_WITH_HIGHLIGHTED_NEIGHBOUR_BORDER; } // will get here only if no neighbour is picked/highlighted return COLOR_NODE_BORDER; } } }; renderContext.setVertexDrawPaintTransformer(vertexOutline); Transformer<NodeWrapper, Paint> vertexBackground = new Transformer<NodeWrapper, Paint>() { @Override public Paint transform(NodeWrapper vertex) { if (vertexPickInfo.isPicked(vertex)) { return COLOR_NODE_PICKED_BG; } else if (vertex.isHighlighted()) { return COLOR_NODE_HIGHLIGHTED_BG; } else { if (GraphViewHelper.hasPickedAdjacentEdge(vertex, edgePickInfo, graph)) { return COLOR_NODE_ADJACENT_EDGE_PICKED_BG; } if (GraphViewHelper.hasPickedNeighbour(vertex, vertexPickInfo, graph)) { return COLOR_NODE_WITH_PICKED_NEIGHBOUR_BG; } else if (GraphViewHelper.hasHighlightedNeighbour(vertex, graph)) { return COLOR_NODE_WITH_HIGHLIGHTED_NEIGHBOUR_BG; } return COLOR_NODE_BG; } } }; renderContext.setVertexFillPaintTransformer(vertexBackground); Transformer<NodeWrapper, Stroke> vertexStroke = new Transformer<NodeWrapper, Stroke>() { @Override public Stroke transform(NodeWrapper vertex) { if (vertexPickInfo.isPicked(vertex)) { return STROKE_VERTEX_PICKED; } else if (vertex.isHighlighted()) { return STROKE_VERTEX_HIGHLIGHTED; } Collection<NodeWrapper> edges = graph.getInEdges(vertex); for (NodeWrapper edge : edges) { if (edgePickInfo.isPicked(edge)) { return STROKE_VERTEX_INCOMING_EDGE_PICKED; } } edges = graph.getOutEdges(vertex); for (NodeWrapper edge : edges) { if (edgePickInfo.isPicked(edge)) { return STROKE_VERTEX_OUTGOING_EDGE_PICKED; } } // we'll only get here if none of the cases above applies return STROKE_VERTEX_DEFAULT; } }; renderContext.setVertexStrokeTransformer(vertexStroke); Transformer<NodeWrapper, Stroke> edgeStroke = new Transformer<NodeWrapper, Stroke>() { @Override public Stroke transform(NodeWrapper edge) { NodeWrapper edgeSource = graph.getSource(edge); if (edgePickInfo.isPicked(edge)) { return STROKE_EDGE_PICKED; } else if (vertexPickInfo.isPicked(edgeSource)) { return STROKE_EDGE_ADJACENT_NODE_PICKED; } else { return STROKE_EDGE_DEFAULT; } } }; renderContext.setEdgeStrokeTransformer(edgeStroke); Transformer<NodeWrapper, Paint> edgeColor = new Transformer<NodeWrapper, Paint>() { @Override public Paint transform(NodeWrapper edge) { if (edgePickInfo.isPicked(edge)) { return COLOR_EDGE_PICKED; } else if (GraphViewHelper.hasPickedAdjacentVertex(edge, vertexPickInfo, graph)) { return COLOR_EDGE_ADJACENT_VERTEX_PICKED; } else if (edge.isHighlighted()) { return COLOR_EDGE_HIGHLIGHTED; } else if (GraphViewHelper.hasHighlightedAdjacentVertex(edge, graph)) { return COLOR_EDGE_ADJACENT_VERTEX_HIGHLIGHTED; } else { return COLOR_EDGE; } } }; renderContext.setEdgeDrawPaintTransformer(edgeColor); // draw arrows in the same colour as edges renderContext.setArrowDrawPaintTransformer(edgeColor); renderContext.setArrowFillPaintTransformer(edgeColor); includePredicate = new IncludePredicate<Context<Graph<NodeWrapper, NodeWrapper>, NodeWrapper>>(); renderContext.setEdgeIncludePredicate(includePredicate); renderContext.setVertexIncludePredicate(includePredicate); vis.setBackground(COLOR_BACKGROUND); mouse = new DoubleClickPickingModalGraphMouse<NodeWrapper, NodeWrapper>(); mouse.add(new AbstractPopupGraphMousePlugin() { @Override protected void handlePopup(MouseEvent e) { if (!e.isPopupTrigger()) { return; } GraphElementAccessor<NodeWrapper, NodeWrapper> pickSupport = vis.getPickSupport(); if (pickSupport == null) { return; } NodeWrapper node = pickSupport.getVertex(layout, e.getX(), e.getY()); if (node == null) { node = pickSupport.getEdge(layout, e.getX(), e.getY()); } if (node == null) { return; } popup.setNodeWrapper(node); popup.show(vis, e.getX(), e.getY()); } }); mouse.setDoubleClickPickingPlugin(new DoubleClickPickingPlugin() { @Override void doubleClickOccurred(MouseEvent e) { GraphElementAccessor<NodeWrapper, NodeWrapper> pickSupport = vis.getPickSupport(); if (pickSupport == null) { return; } NodeWrapper node = pickSupport.getVertex(layout, e.getX(), e.getY()); if (node == null) { return; } fireNodeSelected(node); } }); vis.setGraphMouse(mouse); }
From source file:org.cds06.speleograph.graph.GraphEditor.java
/** * Creates a modal dialog by specifying the attached {@link GraphPanel}. * <p>Please look at {@link javax.swing.JDialog#JDialog()} to see defaults params applied to this Dialog.</p> *///from ww w . j ava2 s.com public GraphEditor(GraphPanel panel) { super((Frame) SwingUtilities.windowForComponent(panel), true); Validate.notNull(panel); this.graphPanel = panel; KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); mainPanel.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); setContentPane(mainPanel); mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); this.setTitle(I18nSupport.translate("menus.graph.graphEditor")); { // This section use FormLayout which is an external layout for Java, consult the doc before edit the // following lines ! final FormLayout layout = new FormLayout( "right:max(40dlu;p), 4dlu, p:grow, 4dlu, p, 4dlu, p:grow, 4dlu, p", //NON-NLS "p,4dlu,p,4dlu,p,4dlu,p,4dlu,p" //NON-NLS ); PanelBuilder builder = new PanelBuilder(layout); final JLabel colorLabel = new JLabel(); final JTextField titleForGraph = new JTextField( graphPanel.getChart().getTitle() != null ? graphPanel.getChart().getTitle().getText() : ""); final JLabel colorXYPlotLabel = new JLabel(); final JLabel colorGridLabel = new JLabel(); final JCheckBox showLegendCheckBox = new JCheckBox("Afficher la lgende", graphPanel.getChart().getLegend().isVisible()); { builder.addLabel("Titre :", "1,1"); builder.add(titleForGraph, "3,1,7,1"); } { builder.addLabel(I18nSupport.translate("menus.graph.graphEditor.backgroundColor"), "1,3"); colorLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); colorLabel.setText(" "); colorLabel.setBackground((Color) graphPanel.getChart().getBackgroundPaint()); colorLabel.setOpaque(true); colorLabel.setEnabled(false); final JButton edit = new JButton(I18nSupport.translate("menus.graph.graphEditor.edit")); edit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(GraphEditor.this, I18nSupport.translate("menus.graph.graphEditor.selectColor"), colorLabel.getBackground()); if (c != null) { colorLabel.setBackground(c); } } }); builder.add(colorLabel, "3,3,5,1"); builder.add(edit, "9,3"); } final XYPlot xyPlot = graphPanel.getChart().getXYPlot(); { builder.addLabel(I18nSupport.translate("menus.graph.graphEditor.graphColor"), "1,5"); colorXYPlotLabel.setText(" "); colorXYPlotLabel.setOpaque(true); colorXYPlotLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); colorXYPlotLabel.setBackground((Color) xyPlot.getBackgroundPaint()); colorXYPlotLabel.setEnabled(false); final JButton edit = new JButton(I18nSupport.translate("menus.graph.graphEditor.edit")); edit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(GraphEditor.this, I18nSupport.translate("menus.graph.graphEditor.selectColor"), colorXYPlotLabel.getBackground()); if (c != null) { colorXYPlotLabel.setBackground(c); } } }); builder.add(colorXYPlotLabel, "3,5,5,1"); builder.add(edit, "9,5"); } { builder.addLabel(I18nSupport.translate("menus.graph.graphEditor.gridColor"), "1,7"); colorGridLabel.setOpaque(true); colorGridLabel.setText(" "); colorGridLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); colorGridLabel.setBackground((Color) xyPlot.getRangeGridlinePaint()); colorGridLabel.setEnabled(false); final JButton edit = new JButton(I18nSupport.translate("menus.graph.graphEditor.edit")); edit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(GraphEditor.this, I18nSupport.translate("menus.graph.graphEditor.selectColor"), colorGridLabel.getBackground()); if (c != null) { colorGridLabel.setBackground(c); } } }); builder.add(colorGridLabel, "3,7,5,1"); builder.add(edit, "9,7"); } { builder.add(showLegendCheckBox, "1,9,9,1"); } mainPanel.add(builder.build(), BorderLayout.CENTER); ButtonBarBuilder buttonBarBuilder = new ButtonBarBuilder(); buttonBarBuilder.addGlue(); buttonBarBuilder.addButton(new AbstractAction() { { putValue(NAME, I18nSupport.translate("cancel")); } @Override public void actionPerformed(ActionEvent e) { GraphEditor.this.setVisible(false); } }); buttonBarBuilder.addButton(new AbstractAction() { { putValue(NAME, I18nSupport.translate("ok")); } @Override public void actionPerformed(ActionEvent e) { if (titleForGraph.getText().isEmpty()) graphPanel.getChart().setTitle((String) null); else graphPanel.getChart().setTitle(titleForGraph.getText()); { Color c = colorGridLabel.getBackground(); xyPlot.setRangeGridlinePaint(c); xyPlot.setRangeMinorGridlinePaint(c); xyPlot.setDomainGridlinePaint(c); xyPlot.setDomainMinorGridlinePaint(c); } graphPanel.getChart().setBackgroundPaint(colorLabel.getBackground()); xyPlot.setBackgroundPaint(colorXYPlotLabel.getBackground()); graphPanel.getChart().getLegend().setVisible(showLegendCheckBox.isSelected()); GraphEditor.this.setVisible(false); } }); mainPanel.add(buttonBarBuilder.build(), BorderLayout.SOUTH); } pack(); Dimension d = this.getPreferredSize(); this.setSize(new Dimension(d.width + 20, d.height)); setResizable(false); }
From source file:de.ailis.xadrian.frames.MainFrame.java
/** * Creates the status bar.//w w w . ja v a2 s. c o m */ private void createStatusBar() { final JLabel statusBar = this.statusBar = new JLabel(" "); statusBar.setBorder(new EmptyBorder(2, 5, 2, 5)); add(statusBar, BorderLayout.SOUTH); addWindowFocusListener(new WindowAdapter() { @Override public void windowLostFocus(final WindowEvent e) { statusBar.setText(" "); } }); }
From source file:net.java.sip.communicator.gui.AuthenticationSplash.java
/** * The user has selected an option. Here we close and dispose the dialog. * If actionCommand is an ActionEvent, getCommandString() is called, * otherwise toString() is used to get the action command. * * @param actionCommand may be null/*from w w w .j a v a 2 s. com*/ */ private void registrationComponents() { Container contents = getContentPane(); contents.setLayout(new BorderLayout()); String title = Utils.getProperty("net.java.sip.communicator.gui.REG_WIN_TITLE"); if (title == null) title = "Registration Manager"; setTitle(title); setResizable(false); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { registrationDialogDone(CMD_CANCEL); } }); // Accessibility -- all frames, dialogs, and applets should // have a description getAccessibleContext().setAccessibleDescription("Registration Splash"); String authPromptLabelValue = Utils.getProperty("net.java.sip.communicator.gui.REGISTRATION_PROMPT"); if (authPromptLabelValue == null) authPromptLabelValue = "Please fill in the following fields to register:"; JLabel splashLabel = new JLabel(authPromptLabelValue); splashLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); splashLabel.setHorizontalAlignment(SwingConstants.CENTER); splashLabel.setHorizontalTextPosition(SwingConstants.CENTER); contents.add(splashLabel, BorderLayout.NORTH); JPanel centerPane = new JPanel(); centerPane.setLayout(new GridBagLayout()); /* My additions */ nameTextField = new JTextField(); //needed below // name label nameLabel = new JLabel(); nameLabel.setLabelFor(nameTextField); String nLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.NAME_LABEL"); if (nLabelStr == null) nLabelStr = "Name"; nameLabel.setText(nLabelStr); int gridy = 0; GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(nameLabel, c); // name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(nameTextField, c); lastNameTextField = new JTextField(); //needed below // last name label lastNameLabel = new JLabel(); lastNameLabel.setLabelFor(nameTextField); String lnLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.LAST_NAME_LABEL"); if (lnLabelStr == null) lnLabelStr = "Last Name"; lastNameLabel.setText(lnLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(lastNameLabel, c); // last name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(lastNameTextField, c); mailTextField = new JTextField(); //needed below // mail label mailLabel = new JLabel(); mailLabel.setLabelFor(mailTextField); String mLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.MAIL_LABEL"); if (mLabelStr == null) mLabelStr = "Email"; mailLabel.setText(mLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(mailLabel, c); // mail text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(mailTextField, c); /* END: MY additions */ userNameTextField = new JTextField(); // needed below // user name label userNameLabel = new JLabel(); userNameLabel.setLabelFor(userNameTextField); String userNameLabelValue = Utils.getProperty("net.java.sip.communicator.gui.USER_NAME_LABEL"); if (userNameLabelValue == null) userNameLabelValue = "Username"; userNameLabel.setText(userNameLabelValue); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(12, 12, 0, 0); centerPane.add(userNameLabel, c); // user name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(12, 7, 0, 11); centerPane.add(userNameTextField, c); passwordTextField = new JPasswordField(); //needed below // password label passwordLabel = new JLabel(); passwordLabel.setLabelFor(passwordTextField); String pLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.PASSWORD_LABEL"); if (pLabelStr == null) pLabelStr = "Password"; passwordLabel.setText(pLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(passwordLabel, c); // password text passwordTextField.setEchoChar('\u2022'); c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(passwordTextField, c); policyDropDown = new JComboBox(); policyDropDown.addItem("Basic"); policyDropDown.addItem("Pro"); policyDropDown.addItem("Enterprise"); // policy label policyLabel = new JLabel(); policyLabel.setLabelFor(policyDropDown); String plcLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.POLICY_LABEL"); if (plcLabelStr == null) plcLabelStr = "Policy"; policyLabel.setText(plcLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(policyLabel, c); // policy menu c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(policyDropDown, c); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, 0)); registerButton = new JButton(); registerButton.setMnemonic('G'); registerButton.setText("Register"); registerButton.setActionCommand(CMD_REGISTER); registerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { registrationDialogDone(event); } }); buttonPanel.add(registerButton); buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); cancelButton = new JButton(); cancelButton.setText("Cancel"); cancelButton.setActionCommand(CMD_CANCEL); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { registrationDialogDone(event); } }); buttonPanel.add(cancelButton); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.insets = new Insets(11, 12, 11, 11); centerPane.add(buttonPanel, c); contents.add(centerPane, BorderLayout.CENTER); getRootPane().setDefaultButton(registerButton); registrationEqualizeButtonSizes(); setFocusTraversalPolicy(new FocusTraversalPol()); }
From source file:net.sf.jabref.gui.plaintextimport.TextInputDialog.java
private void initRawPanel() { rawPanel.setLayout(new BorderLayout()); // Textarea/*from w w w .j a v a2s . c o m*/ textPane.setEditable(false); document = textPane.getStyledDocument(); addStylesToDocument(); try { document.insertString(0, "", document.getStyle("regular")); } catch (BadLocationException ex) { LOGGER.warn("Problem setting style", ex); } OverlayPanel testPanel = new OverlayPanel(textPane, Localization.lang("paste text here")); testPanel.setPreferredSize(new Dimension(450, 255)); testPanel.setMaximumSize(new Dimension(450, Integer.MAX_VALUE)); // Setup fields (required to be done before setting up popup menu) fieldList = new JList<>(getAllFields()); fieldList.setCellRenderer(new SimpleCellRenderer(fieldList.getFont())); ListSelectionModel listSelectionModel = fieldList.getSelectionModel(); listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSelectionModel.addListSelectionListener(new FieldListSelectionHandler()); fieldList.addMouseListener(new FieldListMouseListener()); // After the call to getAllFields initPopupMenuAndToolbar(); //Add listener to components that can bring up popup menus. MouseListener popupListener = new PopupListener(inputMenu); textPane.addMouseListener(popupListener); testPanel.addMouseListener(popupListener); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.add(toolBar, BorderLayout.NORTH); leftPanel.add(testPanel, BorderLayout.CENTER); JPanel inputPanel = setUpFieldListPanel(); // parse with FreeCite button parseWithFreeCiteButton.addActionListener(event -> { if (parseWithFreeCiteAndAddEntries()) { okPressed = false; // we do not want to have the super method to handle our entries, we do it on our own dispose(); } }); rawPanel.add(leftPanel, BorderLayout.CENTER); rawPanel.add(inputPanel, BorderLayout.EAST); JLabel desc = new JLabel("<html><h3>" + Localization.lang("Plain text import") + "</h3><p>" + Localization.lang("This is a simple copy and paste dialog. First load or paste some text into " + "the text input area.<br>After that, you can mark text and assign it to a BibTeX field.") + "</p></html>"); desc.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); rawPanel.add(desc, BorderLayout.SOUTH); }
From source file:com.josue.tileset.editor.Editor.java
private void addAnimatedTile(Tile tile) { if (!tile.equals(selectedTile) && selectedTile != null) { //cannot add the same tile as sequence JLabel label = tileLabels.get(tile); int animatedTileOffset = tile.getId() - selectedTile.getId(); if (selectedTile.getAnimation() != null && selectedTile.getAnimation().getAnimatedSequence().contains(animatedTileOffset)) { selectedTile.getAnimation().getAnimatedSequence() .remove(selectedTile.getAnimation().getAnimatedSequence().indexOf(animatedTileOffset)); if (selectedTile.getAnimation().getAnimatedSequence().isEmpty()) { //is not an animated tile anymore label.setBorder(null); selectedTile.setAnimation(null); }// w w w . j av a 2s . c o m if (animatedPerformer != null) { animatedPerformer.stop(); } } else {//new animated tile if (animatedPerformer != null) { animatedPerformer.stop(); } if (!selectedTile.isAnimated()) { selectedTile.setAnimation(new Animation()); } selectedTile.getAnimation().getAnimatedSequence().add(animatedTileOffset); label.setBorder(new LineBorder(Color.BLUE, 2)); animatedTb.setSelected(true); animatedPerformer = new Timer((int) (selectedTile.getAnimation().getAnimationInterval()), new TileAnimator(selectedTile, previewLabel, loadedTiles)); animatedPerformer.start(); } } }
From source file:net.sf.jabref.gui.journals.ManageJournalsPanel.java
public ManageJournalsPanel(final JabRefFrame frame) { this.frame = frame; personalFile.setEditable(false);//from w ww .ja v a2 s . co m ButtonGroup group = new ButtonGroup(); group.add(newFile); group.add(oldFile); addExtPan.setLayout(new BorderLayout()); JButton addExt = new JButton(IconTheme.JabRefIcon.ADD.getIcon()); addExtPan.add(addExt, BorderLayout.EAST); addExtPan.setToolTipText(Localization.lang("Add")); FormLayout layout = new FormLayout("1dlu, 8dlu, left:pref, 4dlu, fill:200dlu:grow, 4dlu, fill:pref", "pref, pref, pref, 20dlu, 20dlu, fill:200dlu, 4dlu, pref"); FormBuilder builder = FormBuilder.create().layout(layout); builder.addSeparator(Localization.lang("Built-in journal list")).xyw(2, 1, 6); JLabel description = new JLabel( "<HTML>" + Localization.lang("JabRef includes a built-in list of journal abbreviations.") + "<br>" + Localization.lang( "You can add additional journal names by setting up a personal journal list,<br>as " + "well as linking to external journal lists.") + "</HTML>"); description.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); builder.add(description).xyw(2, 2, 6); JButton viewBuiltin = new JButton(Localization.lang("View")); builder.add(viewBuiltin).xy(7, 2); builder.addSeparator(Localization.lang("Personal journal list")).xyw(2, 3, 6); builder.add(newFile).xy(3, 4); builder.add(newNameTf).xy(5, 4); JButton browseNew = new JButton(Localization.lang("Browse")); builder.add(browseNew).xy(7, 4); builder.add(oldFile).xy(3, 5); builder.add(personalFile).xy(5, 5); JButton browseOld = new JButton(Localization.lang("Browse")); builder.add(browseOld).xy(7, 5); userPanel.setLayout(new BorderLayout()); builder.add(userPanel).xyw(2, 6, 4); ButtonStackBuilder butBul = new ButtonStackBuilder(); butBul.addButton(add); butBul.addButton(remove); butBul.addGlue(); builder.add(butBul.getPanel()).xy(7, 6); builder.addSeparator(Localization.lang("External files")).xyw(2, 8, 6); externalFilesPanel.setLayout(new BorderLayout()); setLayout(new BorderLayout()); builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(builder.getPanel(), BorderLayout.NORTH); add(externalFilesPanel, BorderLayout.CENTER); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); JButton ok = new JButton(Localization.lang("OK")); bb.addButton(ok); JButton cancel = new JButton(Localization.lang("Cancel")); bb.addButton(cancel); bb.addUnrelatedGap(); JButton help = new HelpAction(HelpFile.JOURNAL_ABBREV).getHelpButton(); bb.addButton(help); bb.addGlue(); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); dialog = new JDialog(frame, Localization.lang("Journal abbreviations"), false); dialog.getContentPane().add(this, BorderLayout.CENTER); dialog.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); // Set up panel for editing a single journal, to be used in a dialog box: FormLayout layout2 = new FormLayout("right:pref, 4dlu, fill:180dlu", "p, 2dlu, p"); FormBuilder builder2 = FormBuilder.create().layout(layout2); builder2.add(Localization.lang("Journal name")).xy(1, 1); builder2.add(nameTf).xy(3, 1); builder2.add(Localization.lang("ISO abbreviation")).xy(1, 3); builder2.add(abbrTf).xy(3, 3); journalEditPanel = builder2.getPanel(); viewBuiltin.addActionListener(e -> { JTable table = new JTable(JournalAbbreviationsUtil.getTableModel(Globals.journalAbbreviationLoader .getRepository(JournalAbbreviationPreferences.fromPreferences(Globals.prefs)) .getAbbreviations())); JScrollPane pane = new JScrollPane(table); JOptionPane.showMessageDialog(null, pane, Localization.lang("Journal list preview"), JOptionPane.INFORMATION_MESSAGE); }); browseNew.addActionListener(e -> { Path old = null; if (!newNameTf.getText().isEmpty()) { old = Paths.get(newNameTf.getText()); } String name = FileDialogs.getNewFile(frame, old.toFile(), null, JFileChooser.SAVE_DIALOG, false); if (name != null) { newNameTf.setText(name); newFile.setSelected(true); } }); browseOld.addActionListener(e -> { Path old = null; if (!personalFile.getText().isEmpty()) { old = Paths.get(personalFile.getText()); } String name = FileDialogs.getNewFile(frame, old.toFile(), null, JFileChooser.OPEN_DIALOG, false); if (name != null) { personalFile.setText(name); oldFile.setSelected(true); oldFile.setEnabled(true); setupUserTable(); } }); ok.addActionListener(e -> { if (readyToClose()) { storeSettings(); dialog.dispose(); } }); Action cancelAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); } }; cancel.addActionListener(cancelAction); add.addActionListener(tableModel); remove.addActionListener(tableModel); addExt.addActionListener(e -> { externals.add(new ExternalFileEntry()); buildExternalsPanel(); }); // Key bindings: ActionMap am = getActionMap(); InputMap im = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close"); am.put("close", cancelAction); int xSize = getPreferredSize().width; dialog.setSize(xSize + 10, 700); }
From source file:edu.ku.brc.specify.extras.ViewToSchemaReview.java
/** * //w w w . j av a2 s.c o m */ public void checkSchemaAndViews() { Hashtable<String, HashSet<String>> viewFieldHash = new Hashtable<String, HashSet<String>>(); SpecifyAppContextMgr sacm = (SpecifyAppContextMgr) AppContextMgr.getInstance(); for (ViewIFace view : sacm.getEntirelyAllViews()) { //System.err.println(view.getName() + " ----------------------"); for (AltViewIFace av : view.getAltViews()) { ViewDefIFace vd = av.getViewDef(); if (vd.getType() == ViewType.form) { DBTableInfo ti = DBTableIdMgr.getInstance().getByClassName(vd.getClassName()); if (ti != null) { HashSet<String> tiHash = viewFieldHash.get(ti.getName()); if (tiHash == null) { tiHash = new HashSet<String>(); viewFieldHash.put(ti.getName(), tiHash); } FormViewDef fvd = (FormViewDef) vd; for (FormRowIFace row : fvd.getRows()) { for (FormCellIFace cell : row.getCells()) { if (cell.getType() == FormCellIFace.CellType.panel) { FormCellPanelIFace panelCell = (FormCellPanelIFace) cell; for (String fieldName : panelCell.getFieldNames()) { tiHash.add(fieldName); } } else if (cell.getType() == FormCellIFace.CellType.field || cell.getType() == FormCellIFace.CellType.subview) { String fieldName = cell.getName(); if (!cell.isIgnoreSetGet() && !fieldName.equals("this")) { DBFieldInfo fi = ti.getFieldByName(fieldName); if (fi != null) { //System.err.println("Form Field["+fieldName+"] is in schema."); tiHash.add(fieldName); } else { DBRelationshipInfo ri = ti.getRelationshipByName(fieldName); if (ri == null) { //System.err.println("Form Field["+fieldName+"] not in table."); } else { tiHash.add(fieldName); } } } else if (cell instanceof FormCellFieldIFace) { FormCellFieldIFace fcf = (FormCellFieldIFace) cell; if (fcf.getUiType() == FormCellFieldIFace.FieldType.plugin) { String pluginName = fcf.getProperty("name"); if (StringUtils.isNotEmpty(pluginName)) { checkPluginForNames(fcf, pluginName, tiHash); } } } } } } } } } } for (DBTableInfo ti : DBTableIdMgr.getInstance().getTables()) { int cnt = 0; HashSet<String> tiHash = viewFieldHash.get(ti.getName()); if (tiHash != null) { tblTitle2Name.put(ti.getTitle(), ti.getName()); //System.err.println(ti.getName() + " ----------------------"); for (DBFieldInfo fi : ti.getFields()) { Boolean isInForm = tiHash.contains(fi.getName()); modelList.add( createRow(ti.getTitle(), fi.getName(), fi.getTitle(), isInForm, fi.isHidden(), cnt++)); } for (DBRelationshipInfo ri : ti.getRelationships()) { Boolean isInForm = tiHash.contains(ri.getName()); modelList.add( createRow(ti.getTitle(), ri.getName(), ri.getTitle(), isInForm, ri.isHidden(), cnt++)); } } } viewModel = new ViewModel(); JTable table = new JTable(viewModel); sorter = new TableRowSorter<TableModel>(viewModel); searchTF = new JAutoCompTextField(20); table.setRowSorter(sorter); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g,2px,p:g")); SearchBox searchBox = new SearchBox(searchTF, null); filterCBX = UIHelper.createComboBox(new String[] { "None", "Not On Form, Not Hidden", "On Form, Hidden" }); PanelBuilder searchPB = new PanelBuilder(new FormLayout("p,2px,p, f:p:g, p,2px,p", "p")); searchPB.add(UIHelper.createI18NFormLabel("SEARCH"), cc.xy(1, 1)); searchPB.add(searchBox, cc.xy(3, 1)); searchPB.add(UIHelper.createI18NFormLabel("Filter"), cc.xy(5, 1)); searchPB.add(filterCBX, cc.xy(7, 1)); JLabel legend = UIHelper.createLabel( "<HTML><li><font color=\"red\">Red</font> - Not on form and not hidden</li><li><font color=\"magenta\">Magenta</font> - On the form , but is hidden</li><li>Black - Correct</li>"); legend.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); PanelBuilder legPB = new PanelBuilder(new FormLayout("p,f:p:g", "p")); legPB.add(legend, cc.xy(1, 1)); pb.add(searchPB.getPanel(), cc.xy(1, 1)); pb.add(UIHelper.createScrollPane(table), cc.xy(1, 3)); pb.add(legPB.getPanel(), cc.xy(1, 5)); pb.setDefaultDialogBorder(); sorter.setRowFilter(null); searchTF.getDocument().addDocumentListener(new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { SwingUtilities.invokeLater(new Runnable() { /* (non-Javadoc) * @see java.lang.Runnable#run() */ @Override public void run() { if (filterCBX.getSelectedIndex() > 0) { blockCBXUpdate = true; filterCBX.setSelectedIndex(-1); blockCBXUpdate = false; } String text = searchTF.getText(); sorter.setRowFilter(text.isEmpty() ? null : RowFilter.regexFilter("^(?i)" + text, 0, 1)); } }); } }); filterCBX.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (!blockCBXUpdate) { RowFilter<TableModel, Integer> filter = null; int inx = filterCBX.getSelectedIndex(); if (inx > 0) { filter = filterCBX.getSelectedIndex() == 1 ? new NotOnFormNotHiddenRowFilter() : new OnFormIsHiddenRowFilter(); } sorter.setRowFilter(filter); } } }); } }); table.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false)); table.setDefaultRenderer(Boolean.class, new BiColorBooleanTableCellRenderer()); table.getColumnModel().getColumn(0).setCellRenderer(new TitleCellFadeRenderer()); table.getColumnModel().getColumn(3).setCellRenderer(new BiColorTableCellRenderer(true)); table.getColumnModel().getColumn(2).setCellRenderer(new BiColorTableCellRenderer(false) { @SuppressWarnings("unchecked") @Override public Component getTableCellRendererComponent(JTable tableArg, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel lbl = (JLabel) super.getTableCellRendererComponent(tableArg, value, isSelected, hasFocus, row, column); /*if (sorter.getRowFilter() != null) { System.out.println(" getRowCount:"+sorter.getModel().getRowCount()); Pair<String, Integer> col1Pair = (Pair<String, Integer>)sorter.getModel().getValueAt(row, 0); rowData = modelList.get(col1Pair.second); } else { rowData = modelList.get(row); }*/ //System.out.println(" R2:"+row+" "+rowData[0]+"/"+rowData[1]+" - "+rowData[3]+"|"+rowData[4]); if (value instanceof TableInfo) { TableInfo pair = (TableInfo) value; Object[] rowData = modelList.get(pair.getSecond()); lbl.setText(rowData[0].toString()); } else if (value instanceof Pair<?, ?>) { Pair<String, Integer> pair = (Pair<String, Integer>) value; Object[] rowData = modelList.get(pair.getSecond()); boolean isOnForm = rowData[3] instanceof Boolean ? (Boolean) rowData[3] : ((String) rowData[3]).equals("Yes"); boolean isHidden = rowData[4] instanceof Boolean ? (Boolean) rowData[4] : ((String) rowData[4]).equals("true"); if (!isOnForm && !isHidden) { lbl.setForeground(Color.RED); } else if (isOnForm && isHidden) { lbl.setForeground(Color.MAGENTA); } else { lbl.setForeground(Color.BLACK); } lbl.setText(pair.getFirst()); } else { lbl.setText(value.toString()); } return lbl; } }); //UIHelper.makeTableHeadersCentered(table, false); UIHelper.calcColumnWidths(table, null); //Removing fix all button because fix() method is broken (bug #8087)... /*CustomDialog dlg = new CustomDialog((Frame)UIRegistry.getTopWindow(), "", true, CustomDialog.OKCANCELAPPLY, pb.getPanel()) { @Override protected void applyButtonPressed() { fix(this); } }; dlg.setApplyLabel("Fix All");*/ CustomDialog dlg = new CustomDialog((Frame) UIRegistry.getTopWindow(), "", true, CustomDialog.OKCANCEL, pb.getPanel()); //... end removing fix all button dlg.setVisible(true); if (!dlg.isCancelled()) { updateSchema(); } }