Example usage for javax.swing.border EmptyBorder EmptyBorder

List of usage examples for javax.swing.border EmptyBorder EmptyBorder

Introduction

In this page you can find the example usage for javax.swing.border EmptyBorder EmptyBorder.

Prototype

public EmptyBorder(int top, int left, int bottom, int right) 

Source Link

Document

Creates an empty border with the specified insets.

Usage

From source file:dpcs.UninstallUserApps.java

@SuppressWarnings({ "unchecked", "rawtypes", "deprecation" })
public UninstallUserApps() {
    setResizable(false);//from w  w w .  j  a  v a  2s  .c  o m
    setTitle("Uninstall User Apps");
    setIconImage(
            Toolkit.getDefaultToolkit().getImage(UninstallSystemApps.class.getResource("/graphics/Icon.png")));
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 482, 430);
    contentPane = new JPanel();
    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel AppStatus = new JLabel("");
    AppStatus.setBounds(12, 366, 456, 17);
    contentPane.add(AppStatus);

    UserAppUninstallDone = new JLabel("");
    UserAppUninstallDone.setText("");
    UserAppUninstallDone.setBounds(151, 312, 186, 56);
    contentPane.add(UserAppUninstallDone);

    JLabel lblSelect = new JLabel("Select an app to remove");
    lblSelect.setBounds(26, 12, 405, 17);
    contentPane.add(lblSelect);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(22, 41, 428, 259);
    contentPane.add(scrollPane);

    final JButton btnUninstall = new JButton("Uninstall");
    btnUninstall.setToolTipText("Uninstall the selected app");
    btnUninstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            UserAppUninstallDone.setText("");
            if (list.getSelectedValue() == null) {
                JOptionPane.showMessageDialog(null, "Please select an app first");
            } else {
                try {
                    AppStatus.setText("Uninstalling...");
                    String[] commands = new String[3];
                    commands[0] = "adb";
                    commands[1] = "uninstall";
                    commands[2] = "" + list.getSelectedValue();
                    Process p1 = Runtime.getRuntime().exec(commands, null);
                    p1.waitFor();
                    Process p2 = Runtime.getRuntime()
                            .exec("adb shell pm list packages -3 > /sdcard/.userapps.txt");
                    p2.waitFor();
                    Process p3 = Runtime.getRuntime().exec("adb pull /sdcard/.userapps.txt");
                    p3.waitFor();
                    Process p4 = Runtime.getRuntime().exec("adb shell rm /sdcard/.userapps.txt");
                    p4.waitFor();
                    lines = IOUtils.readLines(new FileInputStream(".userapps.txt"));
                    values = new String[lines.size()];
                    values = lines.toArray(values);
                    moddedvalues = new String[values.length];
                    for (int i = 0; i < values.length; i++) {
                        moddedvalues[i] = values[i].substring(8);
                    }
                    list = new JList();
                    list.setModel(new AbstractListModel() {
                        public int getSize() {
                            return moddedvalues.length;
                        }

                        public Object getElementAt(int index) {
                            return moddedvalues[index];
                        }
                    });
                    scrollPane.setViewportView(list);
                    File file = new File(".userapps.txt");
                    if (file.exists() && !file.isDirectory()) {
                        file.delete();
                    }
                    AppStatus.setText("App has been uninstalled successfully");
                    UserAppUninstallDone
                            .setIcon(new ImageIcon(Interface.class.getResource("/graphics/Smalldone.png")));
                    btnUninstall.setSelected(false);
                } catch (Exception e1) {
                    System.err.println(e1);
                }
            }
        }
    });
    btnUninstall.setBounds(26, 327, 107, 27);
    contentPane.add(btnUninstall);

    JButton btnRefresh = new JButton("Refresh");
    btnRefresh.setToolTipText("Refresh the apps list");
    btnRefresh.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                Process p1 = Runtime.getRuntime().exec("adb shell pm list packages -3 > /sdcard/.userapps.txt");
                p1.waitFor();
                Process p2 = Runtime.getRuntime().exec("adb pull /sdcard/.userapps.txt");
                p2.waitFor();
                Process p3 = Runtime.getRuntime().exec("adb shell rm /sdcard/.userapps.txt");
                p3.waitFor();
                lines = IOUtils.readLines(new FileInputStream(".userapps.txt"));
                values = new String[lines.size()];
                values = lines.toArray(values);
                moddedvalues = new String[values.length];
                for (int i = 0; i < values.length; i++) {
                    moddedvalues[i] = values[i].substring(8);
                }
                list = new JList();
                list.setModel(new AbstractListModel() {
                    public int getSize() {
                        return moddedvalues.length;
                    }

                    public Object getElementAt(int index) {
                        return moddedvalues[index];
                    }
                });
                scrollPane.setViewportView(list);
                File file = new File(".userapps.txt");
                if (file.exists() && !file.isDirectory()) {
                    file.delete();
                }
            } catch (Exception e1) {
                System.err.println(e1);
            }
        }
    });
    btnRefresh.setBounds(344, 327, 107, 27);
    contentPane.add(btnRefresh);

    try {
        Process p1 = Runtime.getRuntime().exec("adb shell pm list packages -3 > /sdcard/.userapps.txt");
        p1.waitFor();
        Process p2 = Runtime.getRuntime().exec("adb pull /sdcard/.userapps.txt");
        p2.waitFor();
        Process p3 = Runtime.getRuntime().exec("adb shell rm /sdcard/.userapps.txt");
        p3.waitFor();
        lines = IOUtils.readLines(new FileInputStream(".userapps.txt"));
        values = new String[lines.size()];
        values = lines.toArray(values);
        moddedvalues = new String[values.length];
        for (int i = 0; i < values.length; i++) {
            moddedvalues[i] = values[i].substring(8);
        }
        list = new JList();
        list.setModel(new AbstractListModel() {
            public int getSize() {
                return moddedvalues.length;
            }

            public Object getElementAt(int index) {
                return moddedvalues[index];
            }
        });
        scrollPane.setViewportView(list);
        File file = new File(".userapps.txt");
        if (file.exists() && !file.isDirectory()) {
            file.delete();
        }
    } catch (Exception e1) {
        System.err.println(e1);
    }
}

From source file:org.jfree.chart.demo.selection.SelectionDemo5Category.java

public SelectionDemo5Category(String title) {
    super(title);
    JPanel chartPanel = createDemoPanel();
    chartPanel.setPreferredSize(new Dimension(500, 270));

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.add(chartPanel);//from  w ww  .j  a v a 2s.c o m

    this.model = new DefaultTableModel(new String[] { "row:", "column:", "value:" }, 0);
    this.table = new JTable(this.model);
    TableColumnModel tcm = this.table.getColumnModel();
    JPanel p = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(this.table);
    p.add(scroller);
    p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "),
            new EmptyBorder(4, 4, 4, 4)));
    split.add(p);
    setContentPane(split);
}

From source file:org.jfree.chart.demo.selection.SelectionDemo4.java

/**
 * Creates a new demo.//  ww w . jav a 2s  . c  o m
 * 
 * @param title  the frame title.
 */
public SelectionDemo4(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));

    JFreeChart chart = chartPanel.getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    this.dataset = (HistogramDataset) plot.getDataset();
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.add(chartPanel);

    this.model = new DefaultTableModel(new String[] { "Item:", "Bin Start:", "Bin End:", "Value:" }, 0);
    this.table = new JTable(this.model);
    JPanel p = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(this.table);
    p.add(scroller);
    p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "),
            new EmptyBorder(4, 4, 4, 4)));
    split.add(p);
    setContentPane(split);
}

From source file:au.org.ala.delta.intkey.ui.WebSearchDialog.java

/**
 * Create the dialog./*from  w ww .j  a v  a2s.co m*/
 */
public WebSearchDialog(Dialog owner) {

    super(owner);
    setName("WebSearchDialog");
    ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(WebSearchDialog.class);
    resourceMap.injectFields(this);
    ActionMap actionMap = Application.getInstance().getContext().getActionMap(WebSearchDialog.class, this);

    setTitle(websearchTitle);
    setBounds(100, 100, 450, 250);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    {
        lblSearchFor = new JLabel(searchForLabel);
    }

    txtSearch = new JTextField();
    txtSearch.setColumns(10);

    final JLabel lblUsing = new JLabel(usingLabel);

    cmbSearchEngine = new JComboBox();
    GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
    gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblSearchFor, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
                            .addComponent(cmbSearchEngine, 0, 404, Short.MAX_VALUE)
                            .addComponent(txtSearch, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
                            .addComponent(lblUsing, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_contentPanel
            .setVerticalGroup(
                    gl_contentPanel.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap()
                                    .addComponent(lblSearchFor).addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addComponent(txtSearch, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addGap(27).addComponent(lblUsing)
                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addComponent(cmbSearchEngine, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(41, Short.MAX_VALUE)));
    contentPanel.setLayout(gl_contentPanel);
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("[OK]");
            okButton.setAction(actionMap.get("WebSearchDialog_search"));
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("[Cancel]");
            cancelButton.setAction(actionMap.get("WebSearchDialog_cancel"));
            buttonPane.add(cancelButton);
        }
    }

    LocalConfigFiles files = new LocalConfigFiles("intkey");
    File f = files.getWebsearchIndexFile();
    if (f.exists()) {
        loadSearchEngines(f, cmbSearchEngine);
    }

    cmbSearchEngine.requestFocus();
}

From source file:net.sf.mzmine.modules.visualization.ida.IDABottomPanel.java

IDABottomPanel(IDAVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) {

    this.dataFile = dataFile;
    this.masterFrame = masterFrame;

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    setBackground(Color.white);//from  ww w  .ja va  2  s.  c  om
    setBorder(new EmptyBorder(5, 5, 5, 0));

    add(Box.createHorizontalGlue());

    GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT);

    thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values());
    thresholdCombo.setSelectedItem(PeakThresholdMode.NONE);
    thresholdCombo.setBackground(Color.white);
    thresholdCombo.setFont(smallFont);
    thresholdCombo.addActionListener(this);
    add(thresholdCombo);

    JPanel peakThresholdPanel = new JPanel();
    peakThresholdPanel.setBackground(Color.white);
    peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS));

    GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT);

    peakTextField = new JTextField();
    peakTextField.setPreferredSize(new Dimension(50, 15));
    peakTextField.setFont(smallFont);
    peakTextField.addActionListener(this);
    peakThresholdPanel.add(peakTextField);
    add(peakThresholdPanel);

    GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT);

    peakListSelector = new JComboBox<PeakList>();
    peakListSelector.setBackground(Color.white);
    peakListSelector.setFont(smallFont);
    peakListSelector.addActionListener(masterFrame);
    peakListSelector.setActionCommand("PEAKLIST_CHANGE");
    add(peakListSelector);

    thresholdSettings = parameters.getParameter(IDAParameters.peakThresholdSettings);

    thresholdCombo.setSelectedItem(thresholdSettings.getMode());

    add(Box.createHorizontalStrut(10));

    add(Box.createHorizontalGlue());

}

From source file:edu.harvard.mcz.imagecapture.TemplatePickerDialog.java

protected void init(ICImage image) {
    setBounds(100, 100, 450, 300);/*from   ww w.  jav a2  s .c  o  m*/
    StringBuffer title = new StringBuffer();
    title.append("Change Template");
    if (image != null) {
        title.append(" for ").append(image.getFilename());
    }
    this.setTitle(title.toString());
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        lblTemplate = new JLabel("Template");
        lblTemplate.setHorizontalAlignment(SwingConstants.CENTER);
        contentPanel.add(lblTemplate, BorderLayout.NORTH);
    }
    {
        comboBoxTemplatePicker = new JComboBox<String>();
        comboBoxTemplatePicker.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                PositionTemplate defaultTemplate;
                try {
                    defaultTemplate = new PositionTemplate((String) comboBoxTemplatePicker.getSelectedItem());

                    File fileToCheck = new File(ImageCaptureProperties
                            .assemblePathWithBase(imageToTemplate.getPath(), imageToTemplate.getFilename()));

                    BufferedImage imagefile = ImageIO.read(fileToCheck);

                    int x = defaultTemplate.getBarcodeULPosition().width;
                    int y = defaultTemplate.getBarcodeULPosition().height;
                    int w = defaultTemplate.getBarcodeSize().width;
                    int h = defaultTemplate.getBarcodeSize().height;
                    setBarcodeImage(imagefile.getSubimage(x, y, w, h));

                } catch (NullPointerException e1) {
                    log.error(e1.getMessage());
                } catch (NoSuchTemplateException e1) {
                    log.error(e1.getMessage());
                } catch (IOException e1) {
                    log.error(e1.getMessage());
                }
            }

        });
        contentPanel.add(comboBoxTemplatePicker, BorderLayout.SOUTH);
    }
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 0));
        {
            lblFileName = new JLabel("FileName");
            panel.add(lblFileName, BorderLayout.NORTH);
        }
        {
            labelBarcodeImage = new JLabel("Catalog Number Barcode");
            labelBarcodeImage.setIcon(new ImageIcon(TemplatePickerDialog.class
                    .getResource("/edu/harvard/mcz/imagecapture/resources/gnome-mime-image.png")));
            panel.add(labelBarcodeImage, BorderLayout.CENTER);
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.setActionCommand("OK");
            okButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    // TODO Auto-generated method stub
                    ICImageLifeCycle ils = new ICImageLifeCycle();
                    try {
                        String newTemplateID = (String) comboBoxTemplatePicker.getSelectedItem();
                        if (newTemplateID != null) {
                            imageToTemplate.setTemplateId(newTemplateID);
                            ils.attachDirty(imageToTemplate);
                            setVisible(false);
                        }
                    } catch (SaveFailedException e1) {
                        log.error(e1.getMessage(), e1);
                    }
                }

            });
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.setActionCommand("Cancel");
            cancelButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    setVisible(false);
                }

            });
            buttonPane.add(cancelButton);
        }
    }
    if (image != null) {
        try {
            boolean result = setupForImage(image);
        } catch (UnreadableFileException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:net.sf.mzmine.modules.visualization.msms.MsMsBottomPanel.java

MsMsBottomPanel(MsMsVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) {

    this.dataFile = dataFile;
    this.masterFrame = masterFrame;

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    setBackground(Color.white);// www . ja va  2 s .  c o  m
    setBorder(new EmptyBorder(5, 5, 5, 0));

    add(Box.createHorizontalGlue());

    GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT);

    thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values());
    thresholdCombo.setSelectedItem(PeakThresholdMode.NONE);
    thresholdCombo.setBackground(Color.white);
    thresholdCombo.setFont(smallFont);
    thresholdCombo.addActionListener(this);
    add(thresholdCombo);

    JPanel peakThresholdPanel = new JPanel();
    peakThresholdPanel.setBackground(Color.white);
    peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS));

    GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT);

    peakTextField = new JTextField();
    peakTextField.setPreferredSize(new Dimension(50, 15));
    peakTextField.setFont(smallFont);
    peakTextField.addActionListener(this);
    peakThresholdPanel.add(peakTextField);
    add(peakThresholdPanel);

    GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT);

    peakListSelector = new JComboBox<PeakList>();
    peakListSelector.setBackground(Color.white);
    peakListSelector.setFont(smallFont);
    peakListSelector.addActionListener(masterFrame);
    peakListSelector.setActionCommand("PEAKLIST_CHANGE");
    add(peakListSelector);

    thresholdSettings = parameters.getParameter(MsMsParameters.peakThresholdSettings);

    thresholdCombo.setSelectedItem(thresholdSettings.getMode());

    add(Box.createHorizontalStrut(10));

    add(Box.createHorizontalGlue());

}

From source file:pt.lsts.neptus.plugins.trex.TrexTimelinePanel.java

public TrexTimelinePanel(ConsoleLayout c) {
    super(c);
    setBorder(new EmptyBorder(0, 0, 0, 0));
}

From source file:org.jfree.expdemo.SelectionDemo4.java

/**
 * Creates a new demo./* w  w  w  .j a  v a2s . c om*/
 * 
 * @param title
 *            the frame title.
 */
public SelectionDemo4(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));

    JFreeChart chart = chartPanel.getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    this.dataset = (SimpleHistogramDataset) plot.getDataset();
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.add(chartPanel);

    this.model = new DefaultTableModel(new String[] { "Item:", "Bin Start::", "Bin End:", "Value:" }, 0);
    this.table = new JTable(this.model);
    JPanel p = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(this.table);
    p.add(scroller);
    p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "),
            new EmptyBorder(4, 4, 4, 4)));
    split.add(p);
    setContentPane(split);
}

From source file:org.jfree.chart.demo.selection.SelectionDemo1.java

/**
 * A demonstration application showing how to create a simple time series
 * chart. This example uses monthly data.
 * /* ww w.j  a  va  2 s .  c  o  m*/
 * @param title  the frame title.
 */
public SelectionDemo1(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));

    JFreeChart chart = chartPanel.getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    this.dataset = (TimeSeriesCollection) plot.getDataset();
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.add(chartPanel);

    this.model = new DefaultTableModel(new String[] { "Series:", "Item:", "Period:", "Value:" }, 0);
    this.table = new JTable(this.model);
    TableColumnModel tcm = this.table.getColumnModel();
    tcm.getColumn(3).setCellRenderer(new NumberCellRenderer());
    JPanel p = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(this.table);
    p.add(scroller);
    p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "),
            new EmptyBorder(4, 4, 4, 4)));
    split.add(p);
    setContentPane(split);

}