Search in sources :

Example 31 with Panel

use of java.awt.Panel in project apjp by jvansteirteghem.

the class Main method main.

public static void main(final String[] args) {
    EventQueue.invokeLater(new Runnable() {

        public void run() {
            try {
                System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
                Security.addProvider(new IAIK());
                Properties properties = new Properties();
                properties.load(new FileInputStream("APJP_LOCAL.properties"));
                APJP.APJP_KEY = properties.getProperty("APJP_KEY", "");
                APJP.APJP_LOGGER_ID = "APJP";
                APJP.APJP_LOGGER_LEVEL = 1;
                APJP.APJP_LOCAL_PROXY_SERVER_ADDRESS = properties.getProperty("APJP_LOCAL_PROXY_SERVER_ADDRESS", "");
                try {
                    APJP.APJP_LOCAL_PROXY_SERVER_PORT = new Integer(properties.getProperty("APJP_LOCAL_PROXY_SERVER_PORT", "0"));
                } catch (Exception e) {
                    APJP.APJP_LOCAL_PROXY_SERVER_PORT = 0;
                }
                APJP.APJP_LOCAL_PROXY_SERVER_LOGGER_ID = "APJP_LOCAL_PROXY_SERVER";
                APJP.APJP_LOCAL_PROXY_SERVER_LOGGER_LEVEL = 1;
                APJP.APJP_LOCAL_HTTP_PROXY_SERVER_ADDRESS = properties.getProperty("APJP_LOCAL_HTTP_PROXY_SERVER_ADDRESS", "");
                try {
                    APJP.APJP_LOCAL_HTTP_PROXY_SERVER_PORT = new Integer(properties.getProperty("APJP_LOCAL_HTTP_PROXY_SERVER_PORT", "0"));
                } catch (Exception e) {
                    APJP.APJP_LOCAL_HTTP_PROXY_SERVER_PORT = 0;
                }
                APJP.APJP_LOCAL_HTTP_PROXY_SERVER_LOGGER_ID = "APJP_LOCAL_HTTP_PROXY_SERVER";
                APJP.APJP_LOCAL_HTTP_PROXY_SERVER_LOGGER_LEVEL = 1;
                APJP.APJP_LOCAL_HTTP_SERVER_ADDRESS = properties.getProperty("APJP_LOCAL_HTTP_SERVER_ADDRESS", "");
                try {
                    APJP.APJP_LOCAL_HTTP_SERVER_PORT = new Integer(properties.getProperty("APJP_LOCAL_HTTP_SERVER_PORT", "0"));
                } catch (Exception e) {
                    APJP.APJP_LOCAL_HTTP_SERVER_PORT = 0;
                }
                APJP.APJP_LOCAL_HTTP_SERVER_LOGGER_ID = "APJP_LOCAL_HTTP_SERVER";
                APJP.APJP_LOCAL_HTTP_SERVER_LOGGER_LEVEL = 1;
                APJP.APJP_REMOTE_HTTP_SERVER_REQUEST_URL = new String[10];
                APJP.APJP_REMOTE_HTTP_SERVER_REQUEST_PROPERTY_KEY = new String[10][5];
                APJP.APJP_REMOTE_HTTP_SERVER_REQUEST_PROPERTY_VALUE = new String[10][5];
                for (int i = 0; i < APJP.APJP_REMOTE_HTTP_SERVER_REQUEST_PROPERTY_KEY.length; i = i + 1) {
                    APJP.APJP_REMOTE_HTTP_SERVER_REQUEST_URL[i] = properties.getProperty("APJP_REMOTE_HTTP_SERVER_" + (i + 1) + "_REQUEST_URL", "");
                    for (int j = 0; j < APJP.APJP_REMOTE_HTTP_SERVER_REQUEST_PROPERTY_KEY[i].length; j = j + 1) {
                        APJP.APJP_REMOTE_HTTP_SERVER_REQUEST_PROPERTY_KEY[i][j] = properties.getProperty("APJP_REMOTE_HTTP_SERVER_" + (i + 1) + "_REQUEST_PROPERTY_" + (j + 1) + "_KEY", "");
                        APJP.APJP_REMOTE_HTTP_SERVER_REQUEST_PROPERTY_VALUE[i][j] = properties.getProperty("APJP_REMOTE_HTTP_SERVER_" + (i + 1) + "_REQUEST_PROPERTY_" + (j + 1) + "_VALUE", "");
                    }
                }
                APJP.APJP_LOCAL_HTTPS_PROXY_SERVER_ADDRESS = properties.getProperty("APJP_LOCAL_HTTPS_PROXY_SERVER_ADDRESS", "");
                try {
                    APJP.APJP_LOCAL_HTTPS_PROXY_SERVER_PORT = new Integer(properties.getProperty("APJP_LOCAL_HTTPS_PROXY_SERVER_PORT", "0"));
                } catch (Exception e) {
                    APJP.APJP_LOCAL_HTTPS_PROXY_SERVER_PORT = 0;
                }
                APJP.APJP_LOCAL_HTTPS_PROXY_SERVER_LOGGER_ID = "APJP_LOCAL_HTTPS_PROXY_SERVER";
                APJP.APJP_LOCAL_HTTPS_PROXY_SERVER_LOGGER_LEVEL = 1;
                APJP.APJP_LOCAL_HTTPS_SERVER_ADDRESS = properties.getProperty("APJP_LOCAL_HTTPS_SERVER_ADDRESS", "");
                try {
                    APJP.APJP_LOCAL_HTTPS_SERVER_PORT = new Integer(properties.getProperty("APJP_LOCAL_HTTPS_SERVER_PORT", "0"));
                } catch (Exception e) {
                    APJP.APJP_LOCAL_HTTPS_SERVER_PORT = 0;
                }
                APJP.APJP_LOCAL_HTTPS_SERVER_LOGGER_ID = "APJP_LOCAL_HTTPS_SERVER";
                APJP.APJP_LOCAL_HTTPS_SERVER_LOGGER_LEVEL = 1;
                APJP.APJP_REMOTE_HTTPS_SERVER_REQUEST_URL = new String[10];
                APJP.APJP_REMOTE_HTTPS_SERVER_REQUEST_PROPERTY_KEY = new String[10][5];
                APJP.APJP_REMOTE_HTTPS_SERVER_REQUEST_PROPERTY_VALUE = new String[10][5];
                for (int i = 0; i < APJP.APJP_REMOTE_HTTPS_SERVER_REQUEST_PROPERTY_KEY.length; i = i + 1) {
                    APJP.APJP_REMOTE_HTTPS_SERVER_REQUEST_URL[i] = properties.getProperty("APJP_REMOTE_HTTPS_SERVER_" + (i + 1) + "_REQUEST_URL", "");
                    for (int j = 0; j < APJP.APJP_REMOTE_HTTPS_SERVER_REQUEST_PROPERTY_KEY[i].length; j = j + 1) {
                        APJP.APJP_REMOTE_HTTPS_SERVER_REQUEST_PROPERTY_KEY[i][j] = properties.getProperty("APJP_REMOTE_HTTPS_SERVER_" + (i + 1) + "_REQUEST_PROPERTY_" + (j + 1) + "_KEY", "");
                        APJP.APJP_REMOTE_HTTPS_SERVER_REQUEST_PROPERTY_VALUE[i][j] = properties.getProperty("APJP_REMOTE_HTTPS_SERVER_" + (i + 1) + "_REQUEST_PROPERTY_" + (j + 1) + "_VALUE", "");
                    }
                }
                APJP.APJP_HTTP_PROXY_SERVER_ADDRESS = properties.getProperty("APJP_HTTP_PROXY_SERVER_ADDRESS", "");
                try {
                    APJP.APJP_HTTP_PROXY_SERVER_PORT = new Integer(properties.getProperty("APJP_HTTP_PROXY_SERVER_PORT", "0"));
                } catch (Exception e) {
                    APJP.APJP_HTTP_PROXY_SERVER_PORT = 0;
                }
                APJP.APJP_HTTP_PROXY_SERVER_USERNAME = properties.getProperty("APJP_HTTP_PROXY_SERVER_USERNAME", "");
                APJP.APJP_HTTP_PROXY_SERVER_PASSWORD = properties.getProperty("APJP_HTTP_PROXY_SERVER_PASSWORD", "");
                APJP.APJP_HTTPS_PROXY_SERVER_ADDRESS = properties.getProperty("APJP_HTTPS_PROXY_SERVER_ADDRESS", "");
                try {
                    APJP.APJP_HTTPS_PROXY_SERVER_PORT = new Integer(properties.getProperty("APJP_HTTPS_PROXY_SERVER_PORT", "0"));
                } catch (Exception e) {
                    APJP.APJP_HTTPS_PROXY_SERVER_PORT = 0;
                }
                APJP.APJP_HTTPS_PROXY_SERVER_USERNAME = properties.getProperty("APJP_HTTPS_PROXY_SERVER_USERNAME", "");
                APJP.APJP_HTTPS_PROXY_SERVER_PASSWORD = properties.getProperty("APJP_HTTPS_PROXY_SERVER_PASSWORD", "");
                Authenticator.setDefault(new Authenticator() {

                    protected PasswordAuthentication getPasswordAuthentication() {
                        PasswordAuthentication passwordAuthentication = null;
                        if (this.getRequestorType() == Authenticator.RequestorType.PROXY) {
                            if (this.getRequestingURL().getProtocol().equalsIgnoreCase("HTTP") == true) {
                                passwordAuthentication = new PasswordAuthentication(APJP.APJP_HTTP_PROXY_SERVER_USERNAME, APJP.APJP_HTTP_PROXY_SERVER_PASSWORD.toCharArray());
                            } else {
                                if (this.getRequestingURL().getProtocol().equalsIgnoreCase("HTTPS") == true) {
                                    passwordAuthentication = new PasswordAuthentication(APJP.APJP_HTTPS_PROXY_SERVER_USERNAME, APJP.APJP_HTTPS_PROXY_SERVER_PASSWORD.toCharArray());
                                }
                            }
                        }
                        return passwordAuthentication;
                    }
                });
                logger = Logger.getLogger(APJP.APJP_LOGGER_ID);
                final ProxyServer proxyServer = new ProxyServer();
                final JTextArea outputTextArea = new JTextArea();
                outputTextArea.setEditable(false);
                outputTextArea.setLineWrap(true);
                outputTextArea.setBackground(new Color(0, 0, 0));
                outputTextArea.setForeground(new Color(255, 255, 255));
                outputTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
                final JScrollPane outputScrollPane = new JScrollPane(outputTextArea);
                final OutputStream outputStream = new OutputStream() {

                    public void write(final int b) throws IOException {
                        outputTextArea.append(new String(new char[] { (char) b }));
                    }

                    public void write(final byte[] b, final int off, final int len) throws IOException {
                        outputTextArea.append(new String(b, off, len));
                    }
                };
                final PrintStream printStream = new PrintStream(outputStream, true);
                System.setOut(printStream);
                final JButton startButton = new JButton();
                startButton.setText("Start");
                startButton.setPreferredSize(new Dimension(100, 30));
                startButton.addActionListener(new ActionListener() {

                    public void actionPerformed(final ActionEvent actionEvent) {
                        outputTextArea.setText("");
                        logger.log(1, "START_PROXY_SERVER");
                        try {
                            proxyServer.start();
                            logger.log(1, "START_PROXY_SERVER: OK");
                        } catch (Exception e) {
                            logger.log(1, "START_PROXY_SERVER: EXCEPTION", e);
                            logger.log(1, "START_PROXY_SERVER: NOT OK");
                        }
                        HTTPRequests httpRequests = HTTPRequests.getHTTPRequests();
                        logger.log(1, "TEST_HTTP_REQUESTS");
                        try {
                            httpRequests.test();
                            logger.log(1, "TEST_HTTP_REQUESTS: OK");
                        } catch (Exception e) {
                            logger.log(1, "TEST_HTTP_REQUESTS: EXCEPTION", e);
                            logger.log(1, "TEST_HTTP_REQUESTS: NOT OK");
                        }
                        HTTPSRequests httpsRequests = HTTPSRequests.getHTTPSRequests();
                        logger.log(1, "TEST_HTTPS_REQUESTS");
                        try {
                            httpsRequests.test();
                            logger.log(1, "TEST_HTTPS_REQUESTS: OK");
                        } catch (Exception e) {
                            logger.log(1, "TEST_HTTPS_REQUESTS: EXCEPTION", e);
                            logger.log(1, "TEST_HTTPS_REQUESTS: NOT OK");
                        }
                    }
                });
                final JButton stopButton = new JButton();
                stopButton.setText("Stop");
                stopButton.setPreferredSize(new Dimension(100, 30));
                stopButton.addActionListener(new ActionListener() {

                    public void actionPerformed(final ActionEvent actionEvent) {
                        outputTextArea.setText("");
                        logger.log(1, "STOP_PROXY_SERVER");
                        try {
                            proxyServer.stop();
                            logger.log(1, "STOP_PROXY_SERVER: OK");
                        } catch (Exception e) {
                            logger.log(1, "STOP_PROXY_SERVER: EXCEPTION", e);
                            logger.log(1, "STOP_PROXY_SERVER: NOT OK");
                        }
                    }
                });
                final Panel buttonPanel = new Panel();
                buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
                buttonPanel.add(startButton);
                buttonPanel.add(stopButton);
                final ImageIcon imageIcon = new ImageIcon("APJP_LOCAL.png");
                final JFrame frame = new JFrame();
                frame.setIconImage(imageIcon.getImage());
                frame.setSize(675, 375);
                frame.setResizable(false);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setLayout(new BorderLayout());
                frame.add(buttonPanel, BorderLayout.NORTH);
                frame.add(outputScrollPane, BorderLayout.CENTER);
                if (SystemTray.isSupported()) {
                    final TrayIcon trayIcon = new TrayIcon(imageIcon.getImage());
                    trayIcon.setImageAutoSize(true);
                    trayIcon.addActionListener(new ActionListener() {

                        public void actionPerformed(final ActionEvent actionEvent) {
                            frame.setVisible(!frame.isVisible());
                        }
                    });
                    SystemTray.getSystemTray().add(trayIcon);
                }
                frame.setVisible(true);
            } catch (Exception e) {
                logger.log(1, "EXCEPTION", e);
            }
        }
    });
}
Also used : ImageIcon(javax.swing.ImageIcon) JTextArea(javax.swing.JTextArea) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) OutputStream(java.io.OutputStream) JButton(javax.swing.JButton) HTTPRequests(APJP.HTTP11.HTTPRequests) Properties(java.util.Properties) Font(java.awt.Font) HTTPSRequests(APJP.HTTP11.HTTPSRequests) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) TrayIcon(java.awt.TrayIcon) IAIK(iaik.security.provider.IAIK) Authenticator(java.net.Authenticator) PasswordAuthentication(java.net.PasswordAuthentication) JScrollPane(javax.swing.JScrollPane) PrintStream(java.io.PrintStream) Color(java.awt.Color) IOException(java.io.IOException) Dimension(java.awt.Dimension) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) ProxyServer(APJP.ProxyServer) Panel(java.awt.Panel) ActionListener(java.awt.event.ActionListener)

Example 32 with Panel

use of java.awt.Panel in project lwjgl by LWJGL.

the class DemoBox method initialize.

/**
 * @return
 */
public boolean initialize() {
    setTitle("LWJGL - Demo Box");
    setSize(640, 480);
    setLayout(new GridBagLayout());
    // Setup selection panel
    // =================================
    selectionPanel = new Panel();
    selectionPanel.setLayout(new BorderLayout());
    selectionPanel.add(new Label("Demo", Label.CENTER), BorderLayout.NORTH);
    Button fullScreen = new Button("Fullscreen");
    fullScreen.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            toggleFullscreen();
        }
    });
    selectionPanel.add(fullScreen, BorderLayout.SOUTH);
    final List demos = new List();
    for (Enumeration e = selectableDemos.keys(); e.hasMoreElements(); ) {
        demos.add(e.nextElement().toString());
    }
    selectionPanel.add(demos, BorderLayout.CENTER);
    demos.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent event) {
            demoSelected(event.getItemSelectable().getSelectedObjects()[0].toString());
        }
    });
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = java.awt.GridBagConstraints.BOTH;
    gbc.weightx = 0.05;
    gbc.weighty = 1.0;
    add(selectionPanel, gbc);
    // =================================
    try {
        demoCanvas = new DemoBoxGLCanvas(this);
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.weightx = 0.95;
        gbc.weighty = 1.0;
        add(demoCanvas, gbc);
    } catch (LWJGLException le) {
        le.printStackTrace();
        return false;
    }
    // ---------------------------------
    addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {
            demoCanvas.destroyCanvas();
            dispose();
            System.exit(0);
        }
    });
    // demoSelected(demos.getSelectedItem());
    return true;
}
Also used : ItemEvent(java.awt.event.ItemEvent) GridBagConstraints(java.awt.GridBagConstraints) Enumeration(java.util.Enumeration) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) Label(java.awt.Label) WindowAdapter(java.awt.event.WindowAdapter) Panel(java.awt.Panel) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) Button(java.awt.Button) WindowEvent(java.awt.event.WindowEvent) List(java.awt.List) ItemListener(java.awt.event.ItemListener) LWJGLException(org.lwjgl.LWJGLException)

Example 33 with Panel

use of java.awt.Panel in project GT by Tencent.

the class MemoryView method createChartPanel.

/**
 * 初始化jfreechart
 * @param rootFrame
 */
private void createChartPanel(Composite parent) {
    chartComposite = new Composite(parent, SWT.NO_BACKGROUND | SWT.EMBEDDED);
    FormData formData = new FormData();
    formData.left = new FormAttachment(0, Constant.VIEW_MARGIN_WIDTH);
    formData.right = new FormAttachment(viewer.getTable(), -Constant.VIEW_MARGIN_WIDTH);
    formData.top = new FormAttachment(0, Constant.VIEW_MARGIN_WIDTH);
    formData.bottom = new FormAttachment(100, -Constant.VIEW_MARGIN_WIDTH);
    chartComposite.setLayoutData(formData);
    Frame frame = SWT_AWT.new_Frame(chartComposite);
    // 据说加入这个Panel可以无闪烁
    Panel panel = new Panel(new BorderLayout()) {

        private static final long serialVersionUID = 1L;

        public void update(java.awt.Graphics g) {
            /* Do not erase the background */
            paint(g);
        }
    };
    frame.add(panel);
    JRootPane root = new JRootPane();
    panel.add(root);
    java.awt.Container contentPane = root.getContentPane();
    memRealTimeChart = new MemoryRealTimeChart();
    contentPane.add(memRealTimeChart);
}
Also used : FormData(org.eclipse.swt.layout.FormData) Panel(java.awt.Panel) Frame(java.awt.Frame) Composite(org.eclipse.swt.widgets.Composite) BorderLayout(java.awt.BorderLayout) JRootPane(javax.swing.JRootPane) FormAttachment(org.eclipse.swt.layout.FormAttachment) MemoryRealTimeChart(com.tencent.wstt.apt.chart.MemoryRealTimeChart)

Example 34 with Panel

use of java.awt.Panel in project GT by Tencent.

the class CPUView method createChartPanel.

/**
 * 初始化jfreechart
 * @param rootFrame
 */
private void createChartPanel(Composite parent) {
    // 放置图表的容器对象
    chartComposite = new Composite(parent, SWT.NO_BACKGROUND | SWT.EMBEDDED);
    FormData formData = new FormData();
    formData.left = new FormAttachment(0, Constant.VIEW_MARGIN_WIDTH);
    formData.right = new FormAttachment(cpuViewer.getTable(), -Constant.VIEW_MARGIN_WIDTH);
    formData.top = new FormAttachment(0, Constant.VIEW_MARGIN_WIDTH);
    formData.bottom = new FormAttachment(100, -Constant.VIEW_MARGIN_WIDTH);
    chartComposite.setLayoutData(formData);
    // AWT的根容器
    Frame frame = SWT_AWT.new_Frame(chartComposite);
    // 据说加入这个Panel可以无闪烁
    Panel panel = new Panel(new BorderLayout()) {

        private static final long serialVersionUID = 1L;

        public void update(java.awt.Graphics g) {
            /* Do not erase the background */
            paint(g);
        }
    };
    frame.add(panel);
    JRootPane root = new JRootPane();
    panel.add(root);
    java.awt.Container contentPane = root.getContentPane();
    cpuRealTimeChart = new CPURealTimeChart();
    contentPane.add(cpuRealTimeChart);
}
Also used : FormData(org.eclipse.swt.layout.FormData) Panel(java.awt.Panel) Frame(java.awt.Frame) Composite(org.eclipse.swt.widgets.Composite) BorderLayout(java.awt.BorderLayout) JRootPane(javax.swing.JRootPane) FormAttachment(org.eclipse.swt.layout.FormAttachment) CPURealTimeChart(com.tencent.wstt.apt.chart.CPURealTimeChart)

Example 35 with Panel

use of java.awt.Panel in project GDSC-SMLM by aherbert.

the class SpotAnalysis method createFrame.

@SuppressWarnings({ "rawtypes", "unchecked" })
private void createFrame() {
    final Panel mainPanel = new Panel();
    add(mainPanel);
    inputChoice = new Choice();
    mainPanel.add(createChoicePanel(inputChoice, ""));
    widthTextField = new TextField();
    mainPanel.add(createTextPanel(widthTextField, "PSF width", "1.2"));
    blurTextField = new TextField();
    mainPanel.add(createTextPanel(blurTextField, "Blur (relative to width)", "1"));
    gainTextField = new TextField();
    mainPanel.add(createTextPanel(gainTextField, "Gain", "37.7"));
    exposureTextField = new TextField();
    mainPanel.add(createTextPanel(exposureTextField, "ms/Frame", "20"));
    smoothingTextField = new TextField();
    mainPanel.add(createTextPanel(smoothingTextField, "Smoothing", "0.25"));
    profileButton = new Button("Profile");
    profileButton.addActionListener(this);
    addButton = new Button("Add");
    addButton.addActionListener(this);
    deleteButton = new Button("Remove");
    deleteButton.addActionListener(this);
    saveButton = new Button("Save");
    saveButton.addActionListener(this);
    saveTracesButton = new Button("Save Traces");
    saveTracesButton.addActionListener(this);
    currentLabel = new Label();
    mainPanel.add(createLabelPanel(currentLabel, "", ""));
    rawFittedLabel = new Label();
    mainPanel.add(createLabelPanel(rawFittedLabel, "", ""));
    blurFittedLabel = new Label();
    mainPanel.add(createLabelPanel(blurFittedLabel, "", ""));
    final JPanel buttonPanel = new JPanel();
    final FlowLayout l = new FlowLayout();
    l.setVgap(0);
    buttonPanel.setLayout(l);
    buttonPanel.add(profileButton, BorderLayout.CENTER);
    buttonPanel.add(addButton, BorderLayout.CENTER);
    buttonPanel.add(deleteButton, BorderLayout.CENTER);
    buttonPanel.add(saveButton, BorderLayout.CENTER);
    buttonPanel.add(saveTracesButton, BorderLayout.CENTER);
    mainPanel.add(buttonPanel);
    listModel = new DefaultListModel();
    onFramesList = new JList(listModel);
    onFramesList.setVisibleRowCount(15);
    onFramesList.addListSelectionListener(this);
    final JScrollPane scrollPane = new JScrollPane(onFramesList);
    mainPanel.add(scrollPane);
    final GridBagLayout mainGrid = new GridBagLayout();
    int y = 0;
    final GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = 1;
    c.insets = new Insets(2, 2, 2, 2);
    for (final Component comp : mainPanel.getComponents()) {
        c.gridy = y++;
        mainGrid.setConstraints(comp, c);
    }
    mainPanel.setLayout(mainGrid);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Choice(java.awt.Choice) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Label(java.awt.Label) DefaultListModel(javax.swing.DefaultListModel) Point(java.awt.Point) Panel(java.awt.Panel) JPanel(javax.swing.JPanel) Button(java.awt.Button) TextField(java.awt.TextField) Component(java.awt.Component) JList(javax.swing.JList)

Aggregations

Panel (java.awt.Panel)70 BorderLayout (java.awt.BorderLayout)26 Button (java.awt.Button)25 Label (java.awt.Label)25 Frame (java.awt.Frame)18 GridBagLayout (java.awt.GridBagLayout)17 TextField (java.awt.TextField)17 GridBagConstraints (java.awt.GridBagConstraints)16 JPanel (javax.swing.JPanel)14 Dimension (java.awt.Dimension)13 Insets (java.awt.Insets)10 Point (java.awt.Point)10 Choice (java.awt.Choice)9 FlowLayout (java.awt.FlowLayout)9 Graphics (java.awt.Graphics)9 Checkbox (java.awt.Checkbox)7 GridLayout (java.awt.GridLayout)7 Font (java.awt.Font)6 JButton (javax.swing.JButton)6 Component (java.awt.Component)5