Search in sources :

Example 11 with Container

use of java.awt.Container in project jadx by skylot.

the class UsageDialog method initUI.

private void initUI() {
    JLabel lbl = new JLabel(NLS.str("usage_dialog.label"));
    JLabel nodeLabel = new JLabel(this.node.makeLongString(), this.node.getIcon(), SwingConstants.LEFT);
    lbl.setLabelFor(nodeLabel);
    JPanel searchPane = new JPanel();
    searchPane.setLayout(new FlowLayout(FlowLayout.LEFT));
    searchPane.add(lbl);
    searchPane.add(nodeLabel);
    searchPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    initCommon();
    JPanel resultsPanel = initResultsTable();
    JPanel buttonPane = initButtonsPanel();
    Container contentPane = getContentPane();
    contentPane.add(searchPane, BorderLayout.PAGE_START);
    contentPane.add(resultsPanel, BorderLayout.CENTER);
    contentPane.add(buttonPane, BorderLayout.PAGE_END);
    setTitle(NLS.str("usage_dialog.title"));
    pack();
    setSize(800, 500);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setModalityType(ModalityType.MODELESS);
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) FlowLayout(java.awt.FlowLayout) JLabel(javax.swing.JLabel)

Example 12 with Container

use of java.awt.Container in project jadx by skylot.

the class AboutDialog method initUI.

public final void initUI() {
    Font font = new Font("Serif", Font.BOLD, 13);
    JLabel name = new JLabel("jadx");
    name.setFont(font);
    name.setAlignmentX(0.5f);
    JLabel desc = new JLabel("Dex to Java decompiler");
    desc.setFont(font);
    desc.setAlignmentX(0.5f);
    JLabel version = new JLabel("version: " + JadxDecompiler.getVersion());
    version.setFont(font);
    version.setAlignmentX(0.5f);
    JPanel textPane = new JPanel();
    textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
    textPane.setLayout(new BoxLayout(textPane, BoxLayout.PAGE_AXIS));
    textPane.add(Box.createRigidArea(new Dimension(0, 10)));
    textPane.add(name);
    textPane.add(Box.createRigidArea(new Dimension(0, 10)));
    textPane.add(desc);
    textPane.add(Box.createRigidArea(new Dimension(0, 10)));
    textPane.add(version);
    textPane.add(Box.createRigidArea(new Dimension(0, 20)));
    JButton close = new JButton(NLS.str("tabs.close"));
    close.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            dispose();
        }
    });
    close.setAlignmentX(0.5f);
    Container contentPane = getContentPane();
    contentPane.add(textPane, BorderLayout.CENTER);
    contentPane.add(close, BorderLayout.PAGE_END);
    setModalityType(ModalityType.APPLICATION_MODAL);
    setTitle("About JADX");
    pack();
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Font(java.awt.Font)

Example 13 with Container

use of java.awt.Container in project binnavi by google.

the class ConsoleCodeDocument method insertString.

/**
   * Insert a String of source code to be highlighted to the document. The string is then inserted
   * character by character if longer than 1 char.
   * 
   * @param offs the position in the document
   * @param str the String containig source code
   * @param attr the attributes to set
   */
@Override
public void insertString(final int offs, final String str, final AttributeSet attr) {
    if (offs < 0) {
        return;
    }
    if (str.length() > 1) {
        int i;
        for (i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '\n') {
                remainingTextString = str.substring(i + 1);
                remainingTextAttr = attr;
                inputKeyListener.keyPressed(new KeyEvent(new Container(), KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_ENTER, '\n'));
                break;
            } else {
                insertChar(offs + i, "" + str.charAt(i));
            }
        }
    } else if (str.length() == 1) {
        insertChar(offs, str);
    }
}
Also used : KeyEvent(java.awt.event.KeyEvent) Container(java.awt.Container)

Example 14 with Container

use of java.awt.Container in project jdk8u_jdk by JetBrains.

the class AddNoLeak method main.

public static void main(String[] args) {
    System.setProperty("java.awt.headless", "true");
    Container cont = new Container();
    Image img = cont.createImage(new DummyImageSource());
    for (int i = 0; i < 15000; i++) {
        img.getWidth(new ImageObserver() {

            public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
                return false;
            }
        });
        if (i % 100 == 0) {
            System.gc();
        }
    }
}
Also used : Container(java.awt.Container) ImageObserver(java.awt.image.ImageObserver) Image(java.awt.Image)

Example 15 with Container

use of java.awt.Container in project jdk8u_jdk by JetBrains.

the class RadialGradientPrintingTest method createUI.

public static void createUI() {
    f = new JFrame("RadialGradient Printing Test");
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    final RadialGradientPrintingTest gpt = new RadialGradientPrintingTest();
    Container c = f.getContentPane();
    c.add(BorderLayout.CENTER, gpt);
    final JButton print = new JButton("Print");
    print.addActionListener(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPrintable(gpt);
            final boolean doPrint = job.printDialog();
            if (doPrint) {
                try {
                    job.print();
                } catch (PrinterException ex) {
                    throw new RuntimeException(ex);
                }
            }
        }
    });
    c.add(print, BorderLayout.SOUTH);
    f.pack();
    f.setVisible(true);
}
Also used : Container(java.awt.Container) JFrame(javax.swing.JFrame) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) PrinterException(java.awt.print.PrinterException) AbstractAction(javax.swing.AbstractAction) PrinterJob(java.awt.print.PrinterJob)

Aggregations

Container (java.awt.Container)206 JPanel (javax.swing.JPanel)63 JLabel (javax.swing.JLabel)61 JButton (javax.swing.JButton)53 JScrollPane (javax.swing.JScrollPane)51 BoxLayout (javax.swing.BoxLayout)47 FlowLayout (java.awt.FlowLayout)45 ActionEvent (java.awt.event.ActionEvent)38 BorderLayout (java.awt.BorderLayout)36 Dimension (java.awt.Dimension)33 ActionListener (java.awt.event.ActionListener)26 Component (java.awt.Component)25 JmriJFrame (jmri.util.JmriJFrame)20 JFrame (javax.swing.JFrame)18 Border (javax.swing.border.Border)18 JTextArea (javax.swing.JTextArea)17 JTable (javax.swing.JTable)15 JTextField (javax.swing.JTextField)15 Color (java.awt.Color)13 Point (java.awt.Point)13