Search in sources :

Example 36 with EmptyBorder

use of javax.swing.border.EmptyBorder in project intellij-community by JetBrains.

the class CCShowPreview method showPreviewDialog.

private static void showPreviewDialog(@NotNull Project project, @NotNull VirtualFile userFile, @NotNull TaskFile taskFile) {
    final FrameWrapper showPreviewFrame = new FrameWrapper(project);
    showPreviewFrame.setTitle(userFile.getName());
    LabeledEditor labeledEditor = new LabeledEditor(null);
    final EditorFactory factory = EditorFactory.getInstance();
    Document document = FileDocumentManager.getInstance().getDocument(userFile);
    if (document == null) {
        return;
    }
    final EditorEx createdEditor = (EditorEx) factory.createEditor(document, project, userFile, true);
    Disposer.register(project, new Disposable() {

        public void dispose() {
            factory.releaseEditor(createdEditor);
        }
    });
    for (AnswerPlaceholder answerPlaceholder : taskFile.getActivePlaceholders()) {
        if (answerPlaceholder.getActiveSubtaskInfo().isNeedInsertText()) {
            answerPlaceholder.setLength(answerPlaceholder.getTaskText().length());
        }
        Integer minIndex = Collections.min(answerPlaceholder.getSubtaskInfos().keySet());
        answerPlaceholder.setUseLength(minIndex >= answerPlaceholder.getActiveSubtaskIndex());
        EduAnswerPlaceholderPainter.drawAnswerPlaceholder(createdEditor, answerPlaceholder, JBColor.BLUE);
    }
    JPanel header = new JPanel();
    header.setLayout(new BoxLayout(header, BoxLayout.Y_AXIS));
    header.setBorder(new EmptyBorder(10, 10, 10, 10));
    header.add(new JLabel("Read-only preview."));
    String timeStamp = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(Calendar.getInstance().getTime());
    header.add(new JLabel(String.format("Created %s.", timeStamp)));
    JComponent editorComponent = createdEditor.getComponent();
    labeledEditor.setComponent(editorComponent, header);
    createdEditor.setCaretVisible(false);
    createdEditor.setCaretEnabled(false);
    showPreviewFrame.setComponent(labeledEditor);
    showPreviewFrame.setSize(new Dimension(500, 500));
    if (!ApplicationManager.getApplication().isUnitTestMode()) {
        showPreviewFrame.show();
    }
}
Also used : Disposable(com.intellij.openapi.Disposable) EditorFactory(com.intellij.openapi.editor.EditorFactory) AnswerPlaceholder(com.jetbrains.edu.learning.courseFormat.AnswerPlaceholder) EditorEx(com.intellij.openapi.editor.ex.EditorEx) FrameWrapper(com.intellij.openapi.ui.FrameWrapper) Document(com.intellij.openapi.editor.Document) LabeledEditor(com.intellij.openapi.diff.impl.util.LabeledEditor) EmptyBorder(javax.swing.border.EmptyBorder) SimpleDateFormat(java.text.SimpleDateFormat)

Example 37 with EmptyBorder

use of javax.swing.border.EmptyBorder in project ACS by ACS-Community.

the class CommandCenterGui method prepare.

public void prepare() {
    boolean setLookAndFeel = false;
    if (setLookAndFeel) {
        String lafName = UIManager.getSystemLookAndFeelClassName();
        try {
            UIManager.setLookAndFeel(lafName);
        } catch (Exception exc) {
            log.fine("Couldn't set look and feel " + lafName + " due to " + exc);
        }
    }
    // title added later in doFrameTitle()
    frame = new JFrame("");
    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            controller.stop();
        }
    });
    dlgContainerSettings = new EditContainerSettingsDialog(this);
    frontPanel = new TabPanel(this);
    writeModelToFrontPanel();
    // Splitter between tree and the rest
    splitLeftRight = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitLeftRight.setOneTouchExpandable(true);
    JPanel p2 = new JPanel(new BorderLayout());
    p2.setBorder(new EmptyBorder(10, 10, 10, 10));
    p2.add(frontPanel, BorderLayout.NORTH);
    splitLeftRight.setLeftComponent(p2);
    // Deployment Tree
    deploymentInfoPanel = new JPanel(new BorderLayout());
    deploymentInfoPanel.setBorder(new CompoundBorder(new EmptyBorder(5, 7, 5, 7), new TitledBorder(LineBorder.createBlackLineBorder(), " Deployment Info ")));
    deployTree = new DeploymentTree(controller.deploymentTreeControllerImpl);
    JPanel addToDeployTree = new AddToDeployTree(this, deployTree);
    deploymentInfoPanel.add(addToDeployTree, BorderLayout.NORTH);
    deploymentInfoPanel.add(new JScrollPane(deployTree), BorderLayout.CENTER);
    splitLeftRight.setRightComponent(deploymentInfoPanel);
    // Feedback Area
    feedbackTabs = new FeedbackTabs(this, FeedbackTabs.BOTTOM);
    // Logo Panel
    JPanel logoPanel = new LogoPanel(COLOR_LogoBackground_A, COLOR_LogoBackground_B);
    logoPanel.setLayout(new BorderLayout());
    JLabel alma = new JLabel(new ImageIcon(controller.findResource("alma.jpg")));
    logoPanel.add(alma, BorderLayout.WEST);
    JLabel text = new JLabel("Acs Command Center");
    text.setForeground(COLOR_LogoForeground);
    text.setHorizontalTextPosition(SwingConstants.CENTER);
    text.setFont(text.getFont().deriveFont((float) (text.getFont().getSize() * 2.5)));
    text.setBorder(new EmptyBorder(5, 30, 5, 30));
    logoPanel.add(text, BorderLayout.CENTER);
    //		JLabel version = new JLabel(controller.version());
    //		version.setForeground(COLOR_LogoForeground);
    //		version.setBorder(new EmptyBorder(0, 0, 0, 4));
    //		JPanel pnl2 = new JPanel(new BorderLayout());
    //		pnl2.setOpaque(false);
    //		pnl2.add(version, BorderLayout.SOUTH);
    //		logoPanel.add(pnl2, BorderLayout.EAST);
    menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("Project");
    fileMenu.setMnemonic(KeyEvent.VK_P);
    {
        JMenu newMenu = new JMenu("New");
        newMenu.add(new ActionNewProject("Project"));
        fileMenu.add(newMenu);
    }
    fileMenu.add(new ActionOpenProject("Open..."));
    fileMenu.add(new ActionSaveProject("Save"));
    fileMenu.add(new ActionSaveAsProject("Save As..."));
    fileMenu.addSeparator();
    fileMenu.add(new ActionExit("Exit"));
    menuBar.add(fileMenu);
    toolsMenu = new JMenu("Tools");
    toolsMenu.setMnemonic(KeyEvent.VK_T);
    toolsMenu.add(new ActionConfigureTools("Configure Tools..."));
    toolsMenu.addSeparator();
    menuBar.add(toolsMenu);
    // ---
    JMenu extrasMenu = new JMenu("Expert");
    extrasMenu.setMnemonic(KeyEvent.VK_E);
    {
        //				JMenu sshMode = new JMenu("SSH Library");
        //				sshMode.add(new ActionSetSshMode("Platform-independent", false, false));
        //				sshMode.add(new ActionSetSshMode("Natively installed ssh", true, true));
        //				extrasMenu.add(sshMode);
        //				extrasMenu.add(new JSeparator());
        JMenu extraTools = new JMenu("Tools Menu");
        extraTools.add(new ActionShowExtraTools("View..."));
        extraTools.add(new ActionInstallExtraTools("Replace..."));
        extrasMenu.add(extraTools);
        JMenu builtinTools = new JMenu("Acs Scripts");
        builtinTools.add(new ActionShowBuiltinTools("View..."));
        builtinTools.add(new ActionLoadBuiltinTools("Replace..."));
        extrasMenu.add(builtinTools);
    }
    extrasMenu.add(new JSeparator());
    extrasMenu.add(new ActionShowVariables("Variables..."));
    menuBar.add(extrasMenu);
    // ---
    JMenuItem item;
    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    item = helpMenu.add(new ActionShowHelp("Online Help"));
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    item = helpMenu.add(new ActionShowAbout("About"));
    menuBar.add(Box.createHorizontalGlue());
    menuBar.add(helpMenu);
    // ---
    JPanel h = new JPanel(new SpringLayout());
    h.add(logoPanel);
    h.add(menuBar);
    SpringUtilities.makeCompactGrid(h, 0, 1);
    frame.getContentPane().add(h, BorderLayout.NORTH);
    // ---
    pnlManagerLocationForTools = new ManagerLocationPanel.ForTools();
    managerLocationDialog1 = new BasicDialog(this, "Specify Manager and Services for Tools", "Set", pnlManagerLocationForTools);
    // ---
    pnlManagerLocationForContainers = new ManagerLocationPanel.ForContainers();
    managerLocationDialog2 = new BasicDialog(this, "Specify Manager and Services for Containers", "Set", pnlManagerLocationForContainers);
    // ---
    splitTopBottom = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitLeftRight, feedbackTabs);
    splitTopBottom.setOneTouchExpandable(true);
    // --- 
    // 2009-04: Introducing a desktop layout so i can make the
    // progress dialog a lightweight window on top the front panel
    AccInternalFrame bigInternalFrame = new AccInternalFrame();
    bigInternalFrame.add(splitTopBottom);
    desktop = new JDesktopPane();
    bigInternalFrame.setVisible(true);
    desktop.add(bigInternalFrame);
    frame.getContentPane().add(desktop, BorderLayout.CENTER);
    try {
        bigInternalFrame.setSelected(true);
        bigInternalFrame.setMaximum(true);
    } catch (PropertyVetoException exc) {
    }
    // for mysterious swing reasons, the desktop has a preferred size
    // of (1,1) instead of picking up the preferred size of its child
    // component, so i'm doing this manually here.
    desktop.setPreferredSize(bigInternalFrame.getPreferredSize());
    doFrameTitle();
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) JDesktopPane(javax.swing.JDesktopPane) WindowAdapter(java.awt.event.WindowAdapter) TitledBorder(javax.swing.border.TitledBorder) JSeparator(javax.swing.JSeparator) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) JMenuItem(javax.swing.JMenuItem) JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) PropertyVetoException(java.beans.PropertyVetoException) UnresolvableException(alma.acs.commandcenter.util.VariableString.UnresolvableException) PropertyVetoException(java.beans.PropertyVetoException) WindowEvent(java.awt.event.WindowEvent) SpringLayout(javax.swing.SpringLayout) JSplitPane(javax.swing.JSplitPane) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 38 with EmptyBorder

use of javax.swing.border.EmptyBorder in project zaproxy by zaproxy.

the class ContextSessionManagementPanel method initialize.

/**
	 * Initialize the panel.
	 */
private void initialize() {
    this.setLayout(new CardLayout());
    this.setName(getContextIndex() + ": " + PANEL_NAME);
    this.setLayout(new GridBagLayout());
    this.setBorder(new EmptyBorder(2, 2, 2, 2));
    this.add(new JLabel(Constant.messages.getString("sessionmanagement.panel.label.description")), LayoutHelper.getGBC(0, 0, 1, 1.0D));
    // Session management combo box
    this.add(new JLabel(Constant.messages.getString("sessionmanagement.panel.label.typeSelect")), LayoutHelper.getGBC(0, 1, 1, 1.0D, new Insets(20, 0, 5, 5)));
    this.add(getSessionManagementMethodsComboBox(), LayoutHelper.getGBC(0, 2, 1, 1.0D));
    // Method config panel container
    this.add(getConfigContainerPanel(), LayoutHelper.getGBC(0, 3, 1, 1.0d, new Insets(10, 0, 10, 0)));
    // Padding
    this.add(new JLabel(), LayoutHelper.getGBC(0, 99, 1, 1.0D, 1.0D));
}
Also used : CardLayout(java.awt.CardLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) EmptyBorder(javax.swing.border.EmptyBorder)

Example 39 with EmptyBorder

use of javax.swing.border.EmptyBorder 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 40 with EmptyBorder

use of javax.swing.border.EmptyBorder in project nhin-d by DirectProject.

the class ValidatePanel method initUI.

protected void initUI() {
    setLayout(new BorderLayout());
    setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
    // File Load Fields
    policyFileField = new FileField("Policy Definition File:", "");
    certFileField = new FileField("Certificate File: ", "");
    final JPanel filePanel = new JPanel(new GridLayout(1, 2));
    filePanel.add(certFileField);
    filePanel.add(policyFileField);
    this.add(filePanel, BorderLayout.NORTH);
    // Report panel
    final JLabel reportHeaderLabel = new JLabel("Validation Report");
    reportText = new JTextArea();
    reportText.setLineWrap(true);
    reportText.setWrapStyleWord(true);
    reportText.setEditable(false);
    final JScrollPane scrollPane = new JScrollPane(reportText);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    final JPanel reportPanel = new JPanel(new BorderLayout());
    reportPanel.add(reportHeaderLabel, BorderLayout.NORTH);
    reportPanel.add(scrollPane, BorderLayout.CENTER);
    this.add(reportPanel, BorderLayout.CENTER);
    // Button Panel
    cmdValidate = new JButton("Validate");
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(cmdValidate);
    this.add(buttonPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JTextArea(javax.swing.JTextArea) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) JButton(javax.swing.JButton) SoftBevelBorder(javax.swing.border.SoftBevelBorder) JLabel(javax.swing.JLabel) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Aggregations

EmptyBorder (javax.swing.border.EmptyBorder)224 JPanel (javax.swing.JPanel)96 BorderLayout (java.awt.BorderLayout)87 JLabel (javax.swing.JLabel)70 JButton (javax.swing.JButton)44 JScrollPane (javax.swing.JScrollPane)44 Insets (java.awt.Insets)37 Dimension (java.awt.Dimension)35 Border (javax.swing.border.Border)30 GridBagLayout (java.awt.GridBagLayout)29 ActionEvent (java.awt.event.ActionEvent)27 ActionListener (java.awt.event.ActionListener)27 TitledBorder (javax.swing.border.TitledBorder)25 GridBagConstraints (java.awt.GridBagConstraints)24 Box (javax.swing.Box)22 JTextField (javax.swing.JTextField)21 CompoundBorder (javax.swing.border.CompoundBorder)20 BoxLayout (javax.swing.BoxLayout)17 FlowLayout (java.awt.FlowLayout)16 JCheckBox (javax.swing.JCheckBox)16