Java Code Examples for java.awt.FlowLayout#TRAILING

The following examples show how to use java.awt.FlowLayout#TRAILING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LegendPanel.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private void initComponents() {
    setOpaque(false);
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 4, 5));

    JPanel legendPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 5, 0));
    legendPanel.setOpaque(false);

    gcRootLegend = new JLabel(Bundle.ClassesListController_GcRootString(), BrowserUtils.ICON_GCROOT, SwingConstants.LEFT);
    gcRootLegendDivider = new JLabel("|"); // NOI18N

    legendPanel.add(new JLabel(Bundle.ClassesListController_ArrayTypeString(), BrowserUtils.ICON_ARRAY, SwingConstants.LEFT));
    legendPanel.add(new JLabel("|")); // NOI18N
    legendPanel.add(new JLabel(Bundle.ClassesListController_ObjectTypeString(), BrowserUtils.ICON_INSTANCE, SwingConstants.LEFT));
    legendPanel.add(new JLabel("|")); // NOI18N
    legendPanel.add(new JLabel(Bundle.ClassesListController_PrimitiveTypeString(), BrowserUtils.ICON_PRIMITIVE, SwingConstants.LEFT));
    legendPanel.add(new JLabel("|")); // NOI18N
    legendPanel.add(new JLabel(Bundle.ClassesListController_StaticFieldString(), BrowserUtils.ICON_STATIC, SwingConstants.LEFT));
    legendPanel.add(new JLabel("|")); // NOI18N
    legendPanel.add(gcRootLegend);
    legendPanel.add(gcRootLegendDivider);
    legendPanel.add(new JLabel(Bundle.ClassesListController_LoopString(), BrowserUtils.ICON_LOOP, SwingConstants.LEFT));

    //add(new JLabel("Legend:"), BorderLayout.WEST);
    add(legendPanel, BorderLayout.EAST);
}
 
Example 2
Source File: AddDocumentDialogFactory.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
private JPanel center() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.setOpaque(false);
  panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

  JPanel tableHeader = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
  tableHeader.setOpaque(false);
  tableHeader.add(new JLabel(MessageUtils.getLocalizedMessage("add_document.label.fields")));
  panel.add(tableHeader, BorderLayout.PAGE_START);

  JScrollPane scrollPane = new JScrollPane(fieldsTable());
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  panel.add(scrollPane, BorderLayout.CENTER);

  JPanel tableFooter = new JPanel(new FlowLayout(FlowLayout.TRAILING, 10, 5));
  tableFooter.setOpaque(false);
  addBtn.setEnabled(true);
  tableFooter.add(addBtn);
  tableFooter.add(closeBtn);
  panel.add(tableFooter, BorderLayout.PAGE_END);

  return panel;
}
 
Example 3
Source File: JStatusBar.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public void addRightCorner() {
        JPanel panel = new JPanel(new FlowLayout(
                FlowLayout.TRAILING, 0, 0));
//        panel.setOpaque(false);
//        panel.setBackground(almond);
        JLabel label = new JLabel(new AngledLinesWindowsCornerIcon());
//        label.setAlignmentX(1F);
//        label.setAlignmentY(1F);
        panel.setAlignmentX(1F);
        panel.setAlignmentY(1F);
        label.setHorizontalAlignment(JLabel.RIGHT);
        label.setVerticalAlignment(JLabel.BOTTOM);
        panel.add(label);
        rightPanel.add(panel);
//        rightPanel.add(label);
    }
 
Example 4
Source File: ServiceDialog.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialize "page setup" dialog
 */
void initPageDialog(int x, int y,
                     PrintService ps,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.psCurrent = ps;
    this.docFlavor = flavor;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    pnlPageSetup = new PageSetupPanel();
    c.add(pnlPageSetup, BorderLayout.CENTER);

    pnlPageSetup.updateInfo();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.ok", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 5
Source File: ServiceDialog.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialize "page setup" dialog
 */
void initPageDialog(int x, int y,
                     PrintService ps,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.psCurrent = ps;
    this.docFlavor = flavor;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    pnlPageSetup = new PageSetupPanel();
    c.add(pnlPageSetup, BorderLayout.CENTER);

    pnlPageSetup.updateInfo();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.ok", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 6
Source File: ServiceDialog.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialize "page setup" dialog
 */
void initPageDialog(int x, int y,
                     PrintService ps,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.psCurrent = ps;
    this.docFlavor = flavor;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    pnlPageSetup = new PageSetupPanel();
    c.add(pnlPageSetup, BorderLayout.CENTER);

    pnlPageSetup.updateInfo();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.ok", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 7
Source File: CreateIndexDialogFactory.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JPanel buttons() {
  JPanel panel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
  panel.setOpaque(false);
  panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 10, 20));

  panel.add(indicatorLbl);
  panel.add(createBtn);
  panel.add(cancelBtn);

  return panel;
}
 
Example 8
Source File: IndexOptionsDialogFactory.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JPanel footer() {
  JPanel panel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
  panel.setOpaque(false);
  JButton okBtn = new JButton(MessageUtils.getLocalizedMessage("button.ok"));
  okBtn.setMargin(new Insets(3, 3, 3, 3));
  okBtn.addActionListener(e -> saveOptions());
  panel.add(okBtn);
  JButton cancelBtn = new JButton(MessageUtils.getLocalizedMessage("button.cancel"));
  cancelBtn.setMargin(new Insets(3, 3, 3, 3));
  cancelBtn.addActionListener(e -> dialog.dispose());
  panel.add(cancelBtn);

  return panel;
}
 
Example 9
Source File: ExportTermsDialogFactory.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JPanel actionButtonsPanel() {
  // Buttons
  JPanel execButtons = new JPanel(new FlowLayout(FlowLayout.TRAILING));
  execButtons.setOpaque(false);
  JButton exportBtn = new JButton(MessageUtils.getLocalizedMessage("export.terms.button.export"));
  exportBtn.setMargin(new Insets(3, 0, 3, 0));
  exportBtn.addActionListener(listeners::export);
  execButtons.add(exportBtn);
  JButton closeBtn = new JButton(MessageUtils.getLocalizedMessage("button.close"));
  closeBtn.setMargin(new Insets(3, 0, 3, 0));
  closeBtn.addActionListener(e -> dialog.dispose());
  execButtons.add(closeBtn);
  return execButtons;
}
 
Example 10
Source File: DocValuesDialogFactory.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JPanel headerPanel() {
  JPanel header = new JPanel();
  header.setOpaque(false);
  header.setLayout(new BoxLayout(header, BoxLayout.PAGE_AXIS));

  JPanel fieldHeader = new JPanel(new FlowLayout(FlowLayout.LEADING, 3, 3));
  fieldHeader.setOpaque(false);
  fieldHeader.add(new JLabel(MessageUtils.getLocalizedMessage("documents.docvalues.label.doc_values")));
  fieldHeader.add(new JLabel(field));
  header.add(fieldHeader);

  JPanel typeHeader = new JPanel(new FlowLayout(FlowLayout.LEADING, 3, 3));
  typeHeader.setOpaque(false);
  typeHeader.add(new JLabel(MessageUtils.getLocalizedMessage("documents.docvalues.label.type")));
  typeHeader.add(new JLabel(docValues.getDvType().toString()));
  header.add(typeHeader);

  JPanel decodeHeader = new JPanel(new FlowLayout(FlowLayout.TRAILING, 3, 3));
  decodeHeader.setOpaque(false);
  decodeHeader.add(new JLabel("decoded as"));
  String[] decoders = Arrays.stream(Decoder.values()).map(Decoder::toString).toArray(String[]::new);
  decodersCombo.setModel(new DefaultComboBoxModel<>(decoders));
  decodersCombo.setSelectedItem(Decoder.LONG.toString());
  decodersCombo.addActionListener(listeners::selectDecoder);
  decodeHeader.add(decodersCombo);
  if (docValues.getValues().size() > 0) {
    decodeHeader.setEnabled(false);
  }
  header.add(decodeHeader);

  return header;
}
 
Example 11
Source File: ServiceDialog.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize "page setup" dialog
 */
void initPageDialog(int x, int y,
                     PrintService ps,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.psCurrent = ps;
    this.docFlavor = flavor;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);

    if (attributes.get(DialogOnTop.class) != null) {
        setAlwaysOnTop(true);
    }

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    pnlPageSetup = new PageSetupPanel();
    c.add(pnlPageSetup, BorderLayout.CENTER);

    pnlPageSetup.updateInfo();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.ok", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 12
Source File: ServiceDialog.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize "page setup" dialog
 */
void initPageDialog(int x, int y,
                     PrintService ps,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.psCurrent = ps;
    this.docFlavor = flavor;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);

    if (attributes.get(DialogOnTop.class) != null) {
        setAlwaysOnTop(true);
    }

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    pnlPageSetup = new PageSetupPanel();
    c.add(pnlPageSetup, BorderLayout.CENTER);

    pnlPageSetup.updateInfo();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.ok", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 13
Source File: ServiceDialog.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize print dialog.
 */
void initPrintDialog(int x, int y,
                     PrintService[] services,
                     int defaultServiceIndex,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.services = services;
    this.defaultServiceIndex = defaultServiceIndex;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);
    this.psCurrent = services[defaultServiceIndex];
    this.docFlavor = flavor;
    SunPageSelection pages =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (pages != null) {
        isAWT = true;
    }

    if (attributes.get(DialogOnTop.class) != null) {
        setAlwaysOnTop(true);
    }
    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    tpTabs = new JTabbedPane();
    tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));

    String gkey = getMsg("tab.general");
    int gmnemonic = getVKMnemonic("tab.general");
    pnlGeneral = new GeneralPanel();
    tpTabs.add(gkey, pnlGeneral);
    tpTabs.setMnemonicAt(0, gmnemonic);

    String pkey = getMsg("tab.pagesetup");
    int pmnemonic = getVKMnemonic("tab.pagesetup");
    pnlPageSetup = new PageSetupPanel();
    tpTabs.add(pkey, pnlPageSetup);
    tpTabs.setMnemonicAt(1, pmnemonic);

    String akey = getMsg("tab.appearance");
    int amnemonic = getVKMnemonic("tab.appearance");
    pnlAppearance = new AppearancePanel();
    tpTabs.add(akey, pnlAppearance);
    tpTabs.setMnemonicAt(2, amnemonic);

    c.add(tpTabs, BorderLayout.CENTER);

    updatePanels();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.print", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 14
Source File: MainForm.java    From zxpoly with GNU General Public License v3.0 4 votes vote down vote up
private Optional<SourceSoundPort> showSelectSoundLineDialog(
    final List<SourceSoundPort> variants) {
  assertUiThread();
  final JPanel panel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
  final String previouslySelectedDevice = AppOptions.getInstance().getLastSelectedAudioDevice();

  final JComboBox<SourceSoundPort> comboBox =
      new JComboBox<>(variants.toArray(new SourceSoundPort[0]));
  comboBox.setPrototypeDisplayValue(
      new SourceSoundPort(null, "some very long device name to be shown", null));
  comboBox.addActionListener(x -> {
    comboBox.setToolTipText(comboBox.getSelectedItem().toString());
  });
  comboBox.setToolTipText(comboBox.getSelectedItem().toString());

  int index = -1;
  for (int i = 0; i < comboBox.getItemCount(); i++) {
    if (comboBox.getItemAt(i).toString().equals(previouslySelectedDevice)) {
      index = i;
      break;
    }
  }

  comboBox.setSelectedIndex(Math.max(0, index));

  panel.add(new JLabel("Sound device:"));
  panel.add(comboBox);
  if (JOptionPane.showConfirmDialog(
      this,
      panel,
      "Select sound device",
      JOptionPane.OK_CANCEL_OPTION,
      JOptionPane.PLAIN_MESSAGE
  ) == JOptionPane.OK_OPTION) {
    final SourceSoundPort selected = (SourceSoundPort) comboBox.getSelectedItem();
    AppOptions.getInstance().setLastSelectedAudioDevice(selected.toString());
    return Optional.ofNullable(selected);
  } else {
    return Optional.empty();
  }

}
 
Example 15
Source File: ServiceDialog.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize print dialog.
 */
void initPrintDialog(int x, int y,
                     PrintService[] services,
                     int defaultServiceIndex,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.services = services;
    this.defaultServiceIndex = defaultServiceIndex;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);
    this.psCurrent = services[defaultServiceIndex];
    this.docFlavor = flavor;
    SunPageSelection pages =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (pages != null) {
        isAWT = true;
    }

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    tpTabs = new JTabbedPane();
    tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));

    String gkey = getMsg("tab.general");
    int gmnemonic = getVKMnemonic("tab.general");
    pnlGeneral = new GeneralPanel();
    tpTabs.add(gkey, pnlGeneral);
    tpTabs.setMnemonicAt(0, gmnemonic);

    String pkey = getMsg("tab.pagesetup");
    int pmnemonic = getVKMnemonic("tab.pagesetup");
    pnlPageSetup = new PageSetupPanel();
    tpTabs.add(pkey, pnlPageSetup);
    tpTabs.setMnemonicAt(1, pmnemonic);

    String akey = getMsg("tab.appearance");
    int amnemonic = getVKMnemonic("tab.appearance");
    pnlAppearance = new AppearancePanel();
    tpTabs.add(akey, pnlAppearance);
    tpTabs.setMnemonicAt(2, amnemonic);

    c.add(tpTabs, BorderLayout.CENTER);

    updatePanels();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.print", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 16
Source File: ServiceDialog.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize print dialog.
 */
void initPrintDialog(int x, int y,
                     PrintService[] services,
                     int defaultServiceIndex,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.services = services;
    this.defaultServiceIndex = defaultServiceIndex;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);
    this.psCurrent = services[defaultServiceIndex];
    this.docFlavor = flavor;
    SunPageSelection pages =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (pages != null) {
        isAWT = true;
    }

    if (attributes.get(DialogOnTop.class) != null) {
        setAlwaysOnTop(true);
    }
    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    tpTabs = new JTabbedPane();
    tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));

    String gkey = getMsg("tab.general");
    int gmnemonic = getVKMnemonic("tab.general");
    pnlGeneral = new GeneralPanel();
    tpTabs.add(gkey, pnlGeneral);
    tpTabs.setMnemonicAt(0, gmnemonic);

    String pkey = getMsg("tab.pagesetup");
    int pmnemonic = getVKMnemonic("tab.pagesetup");
    pnlPageSetup = new PageSetupPanel();
    tpTabs.add(pkey, pnlPageSetup);
    tpTabs.setMnemonicAt(1, pmnemonic);

    String akey = getMsg("tab.appearance");
    int amnemonic = getVKMnemonic("tab.appearance");
    pnlAppearance = new AppearancePanel();
    tpTabs.add(akey, pnlAppearance);
    tpTabs.setMnemonicAt(2, amnemonic);

    c.add(tpTabs, BorderLayout.CENTER);

    updatePanels();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.print", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 17
Source File: ServiceDialog.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize "page setup" dialog
 */
void initPageDialog(int x, int y,
                     PrintService ps,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.psCurrent = ps;
    this.docFlavor = flavor;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);

    if (attributes.get(DialogOnTop.class) != null) {
        setAlwaysOnTop(true);
    }

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    pnlPageSetup = new PageSetupPanel();
    c.add(pnlPageSetup, BorderLayout.CENTER);

    pnlPageSetup.updateInfo();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.ok", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 18
Source File: ServiceDialog.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize print dialog.
 */
void initPrintDialog(int x, int y,
                     PrintService[] services,
                     int defaultServiceIndex,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.services = services;
    this.defaultServiceIndex = defaultServiceIndex;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);
    this.psCurrent = services[defaultServiceIndex];
    this.docFlavor = flavor;
    SunPageSelection pages =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (pages != null) {
        isAWT = true;
    }

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    tpTabs = new JTabbedPane();
    tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));

    String gkey = getMsg("tab.general");
    int gmnemonic = getVKMnemonic("tab.general");
    pnlGeneral = new GeneralPanel();
    tpTabs.add(gkey, pnlGeneral);
    tpTabs.setMnemonicAt(0, gmnemonic);

    String pkey = getMsg("tab.pagesetup");
    int pmnemonic = getVKMnemonic("tab.pagesetup");
    pnlPageSetup = new PageSetupPanel();
    tpTabs.add(pkey, pnlPageSetup);
    tpTabs.setMnemonicAt(1, pmnemonic);

    String akey = getMsg("tab.appearance");
    int amnemonic = getVKMnemonic("tab.appearance");
    pnlAppearance = new AppearancePanel();
    tpTabs.add(akey, pnlAppearance);
    tpTabs.setMnemonicAt(2, amnemonic);

    c.add(tpTabs, BorderLayout.CENTER);

    updatePanels();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.print", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 19
Source File: ServiceDialog.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize print dialog.
 */
void initPrintDialog(int x, int y,
                     PrintService[] services,
                     int defaultServiceIndex,
                     DocFlavor flavor,
                     PrintRequestAttributeSet attributes)
{
    this.services = services;
    this.defaultServiceIndex = defaultServiceIndex;
    this.asOriginal = attributes;
    this.asCurrent = new HashPrintRequestAttributeSet(attributes);
    this.psCurrent = services[defaultServiceIndex];
    this.docFlavor = flavor;
    SunPageSelection pages =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (pages != null) {
        isAWT = true;
    }

    if (attributes.get(DialogOnTop.class) != null) {
        setAlwaysOnTop(true);
    }
    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    tpTabs = new JTabbedPane();
    tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));

    String gkey = getMsg("tab.general");
    int gmnemonic = getVKMnemonic("tab.general");
    pnlGeneral = new GeneralPanel();
    tpTabs.add(gkey, pnlGeneral);
    tpTabs.setMnemonicAt(0, gmnemonic);

    String pkey = getMsg("tab.pagesetup");
    int pmnemonic = getVKMnemonic("tab.pagesetup");
    pnlPageSetup = new PageSetupPanel();
    tpTabs.add(pkey, pnlPageSetup);
    tpTabs.setMnemonicAt(1, pmnemonic);

    String akey = getMsg("tab.appearance");
    int amnemonic = getVKMnemonic("tab.appearance");
    pnlAppearance = new AppearancePanel();
    tpTabs.add(akey, pnlAppearance);
    tpTabs.setMnemonicAt(2, amnemonic);

    c.add(tpTabs, BorderLayout.CENTER);

    updatePanels();

    JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    btnApprove = createExitButton("button.print", this);
    pnlSouth.add(btnApprove);
    getRootPane().setDefaultButton(btnApprove);
    btnCancel = createExitButton("button.cancel", this);
    handleEscKey(btnCancel);
    pnlSouth.add(btnCancel);
    c.add(pnlSouth, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            dispose(CANCEL);
        }
    });

    getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle"));
    setResizable(false);
    setLocation(x, y);
    pack();
}
 
Example 20
Source File: SearchPanelProvider.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
private JPanel initSearchResultsHeaderPane() {
  JPanel panel = new JPanel(new GridLayout(1, 2));
  panel.setOpaque(false);

  JLabel label = new JLabel(FontUtils.elegantIconHtml("&#xe025;", MessageUtils.getLocalizedMessage("search.label.results")));
  label.setHorizontalTextPosition(JLabel.LEFT);
  label.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
  panel.add(label);

  JPanel resultsInfo = new JPanel(new FlowLayout(FlowLayout.TRAILING));
  resultsInfo.setOpaque(false);
  resultsInfo.setOpaque(false);

  JLabel totalLabel = new JLabel(MessageUtils.getLocalizedMessage("search.label.total"));
  resultsInfo.add(totalLabel);

  totalHitsLbl.setText("?");
  resultsInfo.add(totalHitsLbl);

  prevBtn.setText(FontUtils.elegantIconHtml("&#x44;"));
  prevBtn.setMargin(new Insets(5, 0, 5, 0));
  prevBtn.setPreferredSize(new Dimension(30, 20));
  prevBtn.setEnabled(false);
  prevBtn.addActionListener(listeners::prevPage);
  resultsInfo.add(prevBtn);

  startLbl.setText("0");
  resultsInfo.add(startLbl);

  resultsInfo.add(new JLabel(" ~ "));

  endLbl.setText("0");
  resultsInfo.add(endLbl);

  nextBtn.setText(FontUtils.elegantIconHtml("&#x45;"));
  nextBtn.setMargin(new Insets(3, 0, 3, 0));
  nextBtn.setPreferredSize(new Dimension(30, 20));
  nextBtn.setEnabled(false);
  nextBtn.addActionListener(listeners::nextPage);
  resultsInfo.add(nextBtn);

  JSeparator sep = new JSeparator(JSeparator.VERTICAL);
  sep.setPreferredSize(new Dimension(5, 1));
  resultsInfo.add(sep);

  delBtn.setText(FontUtils.elegantIconHtml("&#xe07d;", MessageUtils.getLocalizedMessage("search.button.del_all")));
  delBtn.setMargin(new Insets(5, 0, 5, 0));
  delBtn.setEnabled(false);
  delBtn.addActionListener(listeners::confirmDeletion);
  resultsInfo.add(delBtn);

  panel.add(resultsInfo, BorderLayout.CENTER);

  return panel;
}