Search in sources :

Example 86 with Dimension

use of java.awt.Dimension in project ACS by ACS-Community.

the class LogFrame method initialize.

/**
	 * Initialize the content of the frame
	 *
	 * @param discardLevel The discard level
	 * @param unlimited If <code>true</code> the number of logs in memory is unlimited, 
	 *                  otherwise the default is used
	 * @param aInfo The audience
	 */
private void initialize(LogTypeHelper discardLevel, boolean unlimited, AudienceInfo aInfo) {
    setTitle("LoggingClient");
    addWindowListener(this);
    // Set the icon
    ImageIcon image = new ImageIcon(LogFrame.class.getResource("/alma.png"));
    setIconImage(image.getImage());
    // build the LoggingClient
    loggingClient = new LoggingClient(this, LoggingClient.DEFAULT_LOGLEVEL, discardLevel, unlimited, aInfo);
    if (loggingClient == null) {
        throw new NullPointerException("The logging client is null");
    }
    this.setRootPane(loggingClient);
    // Enable the exit menu
    loggingClient.hideExitMenu(false);
    // Move the window to the center of the screen 
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension windowSize = getSize();
    setLocation(Math.max(0, (screenSize.width - windowSize.width) / 2), Math.max(0, (screenSize.height - windowSize.height) / 2));
    pack();
    setVisible(true);
}
Also used : ImageIcon(javax.swing.ImageIcon) LoggingClient(com.cosylab.logging.LoggingClient) Dimension(java.awt.Dimension)

Example 87 with Dimension

use of java.awt.Dimension in project nhin-d by DirectProject.

the class PKCS11SecretKeyManager method initUI.

private void initUI() {
    this.getContentPane().setLayout(new BorderLayout(5, 5));
    // Top Panel
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    addAESKeyButton = new JButton("Add AES Key");
    addAESKeyButton.setSize(new Dimension(30, 100));
    addGenericKeyButton = new JButton("Add Text Key");
    addGenericKeyButton.setSize(new Dimension(30, 100));
    removeKeyButton = new JButton("Remove Key(s)");
    removeKeyButton.setSize(new Dimension(30, 100));
    topPanel.add(addAESKeyButton);
    topPanel.add(addGenericKeyButton);
    topPanel.add(removeKeyButton);
    this.getContentPane().add(topPanel, BorderLayout.NORTH);
    // Middle and list panel
    JPanel midPanel = new JPanel();
    midPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    midPanel.setLayout(new BorderLayout(5, 5));
    JLabel keyListLabel = new JLabel("Secret Keys:");
    Object[][] data = {};
    String[] columnNames = { "Key Alias", "Key Type", "Key Value" };
    keyDataModel = new DefaultTableModel(data, columnNames);
    keyDataTable = new JTable(keyDataModel);
    JScrollPane scrollPane = new JScrollPane(keyDataTable);
    keyDataTable.setFillsViewportHeight(true);
    midPanel.add(keyListLabel, BorderLayout.NORTH);
    midPanel.add(scrollPane, BorderLayout.CENTER);
    this.getContentPane().add(midPanel, BorderLayout.CENTER);
    // Bottom Panel
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    quitButton = new JButton("Quit");
    quitButton.setSize(new Dimension(30, 100));
    bottomPanel.add(quitButton);
    this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) DefaultTableModel(javax.swing.table.DefaultTableModel) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 88 with Dimension

use of java.awt.Dimension in project nhin-d by DirectProject.

the class PKCS11SecretKeyManagerUI method initUI.

private void initUI() {
    this.getContentPane().setLayout(new BorderLayout(5, 5));
    // Top Panel
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    addAESKeyButton = new JButton("Add AES Key");
    addAESKeyButton.setSize(new Dimension(30, 100));
    addGenericKeyButton = new JButton("Add Text Key");
    addGenericKeyButton.setSize(new Dimension(30, 100));
    removeKeyButton = new JButton("Remove Key(s)");
    removeKeyButton.setSize(new Dimension(30, 100));
    topPanel.add(addAESKeyButton);
    topPanel.add(addGenericKeyButton);
    topPanel.add(removeKeyButton);
    this.getContentPane().add(topPanel, BorderLayout.NORTH);
    // Middle and list panel
    JPanel midPanel = new JPanel();
    midPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    midPanel.setLayout(new BorderLayout(5, 5));
    JLabel keyListLabel = new JLabel("Secret Keys:");
    Object[][] data = {};
    String[] columnNames = { "Key Alias", "Key Type", "Key Value" };
    keyDataModel = new DefaultTableModel(data, columnNames);
    keyDataTable = new JTable(keyDataModel);
    JScrollPane scrollPane = new JScrollPane(keyDataTable);
    keyDataTable.setFillsViewportHeight(true);
    midPanel.add(keyListLabel, BorderLayout.NORTH);
    midPanel.add(scrollPane, BorderLayout.CENTER);
    this.getContentPane().add(midPanel, BorderLayout.CENTER);
    // Bottom Panel
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    quitButton = new JButton("Quit");
    quitButton.setSize(new Dimension(30, 100));
    bottomPanel.add(quitButton);
    this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) DefaultTableModel(javax.swing.table.DefaultTableModel) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 89 with Dimension

use of java.awt.Dimension in project nhin-d by DirectProject.

the class CAPanel method initUI.

protected void initUI() {
    setLayout(new BorderLayout());
    //setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
    setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
    createCA = new JRadioButton("Create New CA");
    loadCA = new JRadioButton("Load CA");
    ButtonGroup group = new ButtonGroup();
    group.add(createCA);
    group.add(loadCA);
    createCA.setSelected(true);
    JPanel radioPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    radioPanel.add(createCA);
    radioPanel.add(loadCA);
    JPanel fieldsPanel = new JPanel();
    fieldsPanel.setLayout(new GridLayout(3, 3, 10, 10));
    cnField = new TextEntryField("CN:");
    fieldsPanel.add(cnField);
    countryField = new TextEntryField("Country:");
    fieldsPanel.add(countryField);
    stateField = new TextEntryField("State:");
    fieldsPanel.add(stateField);
    locField = new TextEntryField("Location:");
    fieldsPanel.add(locField);
    orgField = new TextEntryField("Org:");
    fieldsPanel.add(orgField);
    emailField = new TextEntryField("Email:");
    fieldsPanel.add(emailField);
    expField = new SpinEntryField("Experiation (Days):", 365);
    fieldsPanel.add(expField);
    keyStr = new DropDownEntry("Key Strength:", new Object[] { 1024, 2048, 4096 });
    fieldsPanel.add(keyStr);
    passField = new PasswordField("Password:");
    fieldsPanel.add(passField);
    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.add(radioPanel, BorderLayout.NORTH);
    topPanel.add(fieldsPanel, BorderLayout.CENTER);
    add(topPanel, BorderLayout.NORTH);
    new FlowLayout(FlowLayout.LEFT);
    certFileField = new FileField("Certificate Authority File:", "");
    keyFileField = new FileField("Private Key File:", "");
    JPanel filePanel = new JPanel(new GridLayout(1, 2));
    filePanel.add(certFileField);
    filePanel.add(keyFileField);
    loadCert = new JButton("Load");
    loadCert.setVisible(false);
    createCert = new JButton("Create");
    clear = new JButton("Clear");
    clear.setVisible(false);
    clear = new JButton("Clear");
    genCert = new JButton("Create Leaf Cert");
    genCert.setVisible(false);
    signCSR = new JButton("Sign CSR");
    signCSR.setVisible(false);
    addToAltSubjects = new JCheckBox("Add Email To Alt Subject Names");
    addToAltSubjects.setVisible(false);
    addToAltSubjects.setSelected(true);
    allowedToSign = new JCheckBox("Allowed To Sign Certificates");
    allowedToSign.setVisible(false);
    keyEnc = new JCheckBox("Key Encipherment Use");
    keyEnc.setVisible(false);
    keyEnc.setSelected(true);
    digitalSig = new JCheckBox("Digital Signature Use");
    digitalSig.setVisible(false);
    keyEnc.setSelected(true);
    JPanel addAltPanel = new JPanel(new GridLayout(2, 2));
    addAltPanel.setPreferredSize(new Dimension(450, addAltPanel.getPreferredSize().height));
    //addAltPanel.add(addToAltSubjects);
    addAltPanel.add(allowedToSign);
    addAltPanel.add(keyEnc);
    addAltPanel.add(digitalSig);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(addAltPanel);
    buttonPanel.add(loadCert);
    buttonPanel.add(createCert);
    buttonPanel.add(clear);
    buttonPanel.add(genCert);
    buttonPanel.add(signCSR);
    JPanel combineAltAndButtonPanel = new JPanel(new BorderLayout());
    //combineAltAndButtonPanel.add(addAltPanel, BorderLayout.WEST);
    combineAltAndButtonPanel.add(buttonPanel, BorderLayout.EAST);
    JPanel bottomPannel = new JPanel(new BorderLayout());
    bottomPannel.add(filePanel, BorderLayout.NORTH);
    bottomPannel.add(combineAltAndButtonPanel, BorderLayout.SOUTH);
    this.add(bottomPannel, BorderLayout.SOUTH);
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) FlowLayout(java.awt.FlowLayout) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) SoftBevelBorder(javax.swing.border.SoftBevelBorder) CompoundBorder(javax.swing.border.CompoundBorder) JPasswordField(javax.swing.JPasswordField) EmptyBorder(javax.swing.border.EmptyBorder)

Example 90 with Dimension

use of java.awt.Dimension in project opennms by OpenNMS.

the class FRLayoutAlgorithm method updateLayout.

@Override
public void updateLayout(final Graph graph) {
    final Layout graphLayout = graph.getLayout();
    SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>();
    Collection<Vertex> vertices = graph.getDisplayVertices();
    for (Vertex v : vertices) {
        jungGraph.addVertex(v);
    }
    Collection<Edge> edges = graph.getDisplayEdges();
    for (Edge e : edges) {
        jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex());
    }
    FRLayout<VertexRef, EdgeRef> layout = new FRLayout<VertexRef, EdgeRef>(jungGraph);
    // Initialize the vertex positions to the last known positions from the layout
    Dimension size = selectLayoutSize(graph);
    layout.setInitializer(initializer(graphLayout, (int) size.getWidth() / 2, (int) size.getHeight() / 2));
    // Resize the graph to accommodate the number of vertices
    layout.setSize(size);
    while (!layout.done()) {
        layout.step();
    }
    // Store the new positions in the layout
    for (Vertex v : vertices) {
        graphLayout.setLocation(v, new Point(layout.getX(v) - (size.getWidth() / 2), (int) layout.getY(v) - (size.getHeight() / 2)));
    }
}
Also used : Vertex(org.opennms.features.topology.api.topo.Vertex) FRLayout(edu.uci.ics.jung.algorithms.layout.FRLayout) Dimension(java.awt.Dimension) Point(org.opennms.features.topology.api.Point) SparseGraph(edu.uci.ics.jung.graph.SparseGraph) Layout(org.opennms.features.topology.api.Layout) FRLayout(edu.uci.ics.jung.algorithms.layout.FRLayout) EdgeRef(org.opennms.features.topology.api.topo.EdgeRef) VertexRef(org.opennms.features.topology.api.topo.VertexRef) Edge(org.opennms.features.topology.api.topo.Edge)

Aggregations

Dimension (java.awt.Dimension)4003 JPanel (javax.swing.JPanel)1091 JLabel (javax.swing.JLabel)742 Point (java.awt.Point)683 JButton (javax.swing.JButton)671 ActionEvent (java.awt.event.ActionEvent)644 ActionListener (java.awt.event.ActionListener)583 JScrollPane (javax.swing.JScrollPane)558 BorderLayout (java.awt.BorderLayout)492 Insets (java.awt.Insets)411 BoxLayout (javax.swing.BoxLayout)334 GridBagLayout (java.awt.GridBagLayout)312 GridBagConstraints (java.awt.GridBagConstraints)266 FlowLayout (java.awt.FlowLayout)242 JTextField (javax.swing.JTextField)235 ImageIcon (javax.swing.ImageIcon)216 Component (java.awt.Component)215 Color (java.awt.Color)205 ChangeEvent (javax.swing.event.ChangeEvent)200 ChangeListener (javax.swing.event.ChangeListener)198