Search in sources :

Example 1 with SetupButton

use of com.badlogic.gdx.setup.GdxSetupUI.SetupButton in project libgdx by libgdx.

the class ExternalExtensionsDialog method uiLayout.

private void uiLayout() {
    topPanel = new JPanel(new GridBagLayout());
    topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    warningNotice = new JLabel("List of third party extensions for LibGDX");
    warningNotice2 = new JLabel("These are not maintained by the LibGDX team, please see the support links for info and help");
    warningNotice.setHorizontalAlignment(JLabel.CENTER);
    warningNotice2.setHorizontalAlignment(JLabel.CENTER);
    topPanel.add(warningNotice, new GridBagConstraints(0, 0, 1, 1, 1, 0, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    topPanel.add(warningNotice2, new GridBagConstraints(0, 1, 1, 1, 1, 0, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    JSeparator separator = new JSeparator();
    separator.setForeground(new Color(85, 85, 85));
    separator.setBackground(new Color(85, 85, 85));
    topPanel.add(separator, new GridBagConstraints(0, 2, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    tableModel = new ExtensionTableModel();
    table = new JTable(tableModel) {

        @Override
        public String getToolTipText(MouseEvent e) {
            return ((ExtensionTableModel) getModel()).getToolTip(e);
        }
    };
    table.getColumnModel().getColumn(0).setPreferredWidth(10);
    table.getColumnModel().getColumn(1).setPreferredWidth(50);
    table.getColumnModel().getColumn(2).setPreferredWidth(100);
    table.getColumnModel().getColumn(3).setPreferredWidth(20);
    table.getColumnModel().getColumn(4).setPreferredWidth(30);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    table.getTableHeader().setReorderingAllowed(false);
    table.getModel().addTableModelListener(this);
    table.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            int row = table.getSelectedRow();
            int column = table.getSelectedColumn();
            if (column == 5) {
                URI uri = ((ExtensionTableModel) table.getModel()).getURI(row, column);
                if (uri != null) {
                    try {
                        Desktop.getDesktop().browse(uri);
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        }
    });
    scrollPane = new JScrollPane(table);
    bottomPanel = new JPanel(new GridBagLayout());
    buttonPanel = new JPanel(new GridBagLayout());
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    buttonOK = new SetupButton("Save");
    buttonCancel = new SetupButton("Cancel");
    buttonPanel.add(buttonOK, new GridBagConstraints(0, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    buttonPanel.add(buttonCancel, new GridBagConstraints(1, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    bottomPanel.add(buttonPanel, new GridBagConstraints(3, 0, 1, 1, 1, 1, SOUTHEAST, NONE, new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(topPanel, new GridBagConstraints(0, 0, 1, 1, 1, 0.1, NORTH, BOTH, new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(scrollPane, new GridBagConstraints(0, 1, 1, 1, 1, 1, NORTH, BOTH, new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(bottomPanel, new GridBagConstraints(0, 2, 1, 1, 1, 0, SOUTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    try {
        initData();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) SetupButton(com.badlogic.gdx.setup.GdxSetupUI.SetupButton) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) IOException(java.io.IOException) URI(java.net.URI) JSeparator(javax.swing.JSeparator) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException) JTable(javax.swing.JTable)

Example 2 with SetupButton

use of com.badlogic.gdx.setup.GdxSetupUI.SetupButton in project libgdx by libgdx.

the class SettingsDialog method uiLayout.

private void uiLayout() {
    content = new JPanel(new GridBagLayout());
    content.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    bottomPanel = new JPanel(new GridBagLayout());
    buttonPanel = new JPanel(new GridBagLayout());
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    buttonOK = new SetupButton("Save");
    buttonCancel = new SetupButton("Cancel");
    buttonPanel.add(buttonOK, new GridBagConstraints(0, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    buttonPanel.add(buttonCancel, new GridBagConstraints(1, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(content, new GridBagConstraints(0, 0, 1, 1, 1, 1, NORTH, BOTH, new Insets(0, 0, 0, 0), 0, 0));
    JLabel settings = new JLabel("Settings");
    JLabel description = new JLabel("Description");
    settings.setForeground(new Color(255, 255, 255));
    description.setForeground(new Color(255, 255, 255));
    settings.setHorizontalAlignment(JLabel.CENTER);
    description.setHorizontalAlignment(JLabel.CENTER);
    content.add(settings, new GridBagConstraints(0, 0, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    content.add(description, new GridBagConstraints(3, 0, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    JLabel mavenLabel = new JLabel("Maven Mirror Url");
    JLabel mavenDesc = new JLabel("Replaces Maven Central with this repository");
    mavenTextField = new JTextField(15);
    mavenTextField.setMinimumSize(mavenTextField.getPreferredSize());
    mavenLabel.setForeground(new Color(170, 170, 170));
    mavenDesc.setForeground(new Color(170, 170, 170));
    JLabel ideaLabel = new JLabel("IDEA");
    JLabel ideaDesc = new JLabel("Generates Intellij IDEA project files");
    ideaBox = new SetupCheckBox();
    ideaLabel.setForeground(new Color(170, 170, 170));
    ideaDesc.setForeground(new Color(170, 170, 170));
    ideaBox.setBackground(new Color(36, 36, 36));
    JLabel eclipseLabel = new JLabel("Eclipse");
    JLabel eclipseDesc = new JLabel("Generates Eclipse project files");
    eclipseBox = new SetupCheckBox();
    eclipseLabel.setForeground(new Color(170, 170, 170));
    eclipseDesc.setForeground(new Color(170, 170, 170));
    eclipseBox.setBackground(new Color(36, 36, 36));
    JLabel offlineLabel = new JLabel("Offline Mode");
    JLabel offlineDesc = new JLabel("Don't force download dependencies");
    offlineBox = new SetupCheckBox();
    offlineLabel.setForeground(new Color(170, 170, 170));
    offlineDesc.setForeground(new Color(170, 170, 170));
    offlineBox.setBackground(new Color(36, 36, 36));
    JSeparator separator = new JSeparator();
    separator.setForeground(new Color(85, 85, 85));
    separator.setBackground(new Color(85, 85, 85));
    content.add(separator, new GridBagConstraints(0, 1, 4, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    content.add(mavenLabel, new GridBagConstraints(0, 2, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    content.add(mavenTextField, new GridBagConstraints(1, 2, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
    content.add(mavenDesc, new GridBagConstraints(3, 2, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
    content.add(ideaLabel, new GridBagConstraints(0, 3, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    content.add(ideaBox, new GridBagConstraints(1, 3, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
    content.add(ideaDesc, new GridBagConstraints(3, 3, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
    content.add(eclipseLabel, new GridBagConstraints(0, 4, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    content.add(eclipseBox, new GridBagConstraints(1, 4, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
    content.add(eclipseDesc, new GridBagConstraints(3, 4, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
    content.add(offlineLabel, new GridBagConstraints(0, 5, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    content.add(offlineBox, new GridBagConstraints(1, 5, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
    content.add(offlineDesc, new GridBagConstraints(3, 5, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
    String text = "<p style=\"font-size:10\">Click for more info on using Gradle without IDE integration</p>";
    linkText = new JLabel("<html>" + text + "</html>");
    bottomPanel.add(linkText, new GridBagConstraints(0, 0, 1, 1, 1, 1, WEST, NONE, new Insets(0, 10, 0, 0), 0, 0));
    bottomPanel.add(buttonPanel, new GridBagConstraints(3, 0, 1, 1, 1, 1, SOUTHEAST, NONE, new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(bottomPanel, new GridBagConstraints(0, 1, 4, 1, 1, 1, SOUTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) SetupButton(com.badlogic.gdx.setup.GdxSetupUI.SetupButton) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) SetupCheckBox(com.badlogic.gdx.setup.GdxSetupUI.SetupCheckBox) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator)

Aggregations

SetupButton (com.badlogic.gdx.setup.GdxSetupUI.SetupButton)2 Color (java.awt.Color)2 GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2 Insets (java.awt.Insets)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 JSeparator (javax.swing.JSeparator)2 SetupCheckBox (com.badlogic.gdx.setup.GdxSetupUI.SetupCheckBox)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 JScrollPane (javax.swing.JScrollPane)1 JTable (javax.swing.JTable)1 JTextField (javax.swing.JTextField)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 SAXException (org.xml.sax.SAXException)1