Advertisement
Guest User

Untitled

a guest
Dec 29th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.21 KB | None | 0 0
  1. package com.subreddimages.GUIComponents;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.LayoutManager;
  6. import java.awt.event.MouseAdapter;
  7. import java.awt.event.MouseListener;
  8. import java.text.Collator;
  9.  
  10. import javax.swing.ComboBoxModel;
  11. import javax.swing.border.Border;
  12. import javax.swing.event.ChangeListener;
  13. import javax.swing.filechooser.FileNameExtensionFilter;
  14.  
  15. public class GUIComponents {
  16.    
  17.     public static class Components{
  18.         public javax.swing.JFrame JFrame(String title, Font font, Boolean resizable, Color background, Integer closetype, LayoutManager layout, Integer[] bounds){
  19.             javax.swing.JFrame jframe = new javax.swing.JFrame(title);
  20.             jframe.setFont(font);
  21.             jframe.setResizable(resizable);
  22.             jframe.getContentPane().setBackground(background);
  23.             jframe.getContentPane().setLayout(layout);
  24.             jframe.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  25.             jframe.setDefaultCloseOperation(closetype);
  26.             return jframe;
  27.         }
  28.         public javax.swing.JButton JButton(String name, MouseListener mouseevent, String tooltiptext, Color foreground, Font font, Integer[] bounds) {
  29.             javax.swing.JButton jbutton = new javax.swing.JButton(name);   
  30.             jbutton.addMouseListener(mouseevent);
  31.             jbutton.setToolTipText(tooltiptext);
  32.             jbutton.setForeground(foreground);
  33.             jbutton.setFont(font);
  34.             jbutton.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]); 
  35.             return jbutton;
  36.         }
  37.         public javax.swing.JPanel JPanel(Border border, Color background, LayoutManager layout, Integer[] bounds){
  38.             javax.swing.JPanel jpanel = new javax.swing.JPanel();
  39.             jpanel.setBorder(border);
  40.             jpanel.setBackground(background);
  41.             jpanel.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  42.             jpanel.setLayout(layout);
  43.             return jpanel;
  44.         }
  45.         public javax.swing.JLabel JLabel(String text, String name, String tooltiptext, Font font, Color foreground, Integer[] bounds){
  46.             javax.swing.JLabel jlabel = new javax.swing.JLabel(text);
  47.             jlabel.setToolTipText(tooltiptext);
  48.             jlabel.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  49.             jlabel.setFont(font);
  50.             jlabel.setForeground(foreground);
  51.             jlabel.setName(name);
  52.             return jlabel;
  53.         }
  54.         public javax.swing.JComboBox JComboBox(String name, String tooltiptext, Color foreground, Color background, Font font, ComboBoxModel model, Integer[] bounds){
  55.             javax.swing.JComboBox jcombobox = new javax.swing.JComboBox();
  56.             jcombobox.setName(name);
  57.             jcombobox.setToolTipText(tooltiptext);
  58.             jcombobox.setForeground(foreground);
  59.             jcombobox.setBackground(background);
  60.             jcombobox.setFont(font);
  61.             jcombobox.setModel(model);
  62.             jcombobox.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  63.             return jcombobox;
  64.         }
  65.         public javax.swing.JCheckBox JCheckBox(String name, String tooltiptext, Integer[] bounds){
  66.             javax.swing.JCheckBox jcheckbox = new javax.swing.JCheckBox();
  67.             jcheckbox.setName(name);
  68.             jcheckbox.setToolTipText(tooltiptext);
  69.             jcheckbox.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  70.             return jcheckbox;
  71.         }
  72.         public javax.swing.JSlider JSlider(String name, String tooltiptext, ChangeListener listener, Integer value, Integer min, Integer max, Integer[] bounds){
  73.             javax.swing.JSlider jslider = new javax.swing.JSlider();
  74.             jslider.setName(name);
  75.             jslider.setToolTipText(tooltiptext);
  76.             jslider.setMinimum(min);
  77.             jslider.setMaximum(max);
  78.             jslider.setValue(value);
  79.             jslider.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  80.             jslider.addChangeListener(listener);
  81.             return jslider;
  82.         }
  83.         public javax.swing.JRadioButton JRadioButton(String text, String name, Boolean selected, Color foreground, Font font, Integer[] bounds){
  84.             javax.swing.JRadioButton jradiobutton = new javax.swing.JRadioButton(text);
  85.             jradiobutton.setName(name);
  86.             jradiobutton.setFont(font);
  87.             jradiobutton.setForeground(foreground);
  88.             jradiobutton.setSelected(selected);
  89.             jradiobutton.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  90.             return jradiobutton;
  91.         }
  92.         public javax.swing.JFileChooser JFileChooser(Font font, Color background, Integer selectionmode, FileNameExtensionFilter fex, Boolean acceptall){/////
  93.             javax.swing.JFileChooser jfilechooser = new javax.swing.JFileChooser();
  94.             jfilechooser.setFont(font);
  95.             jfilechooser.setBackground(background);
  96.             if(selectionmode != null) {
  97.                 jfilechooser.setFileSelectionMode(selectionmode);
  98.             }
  99.             jfilechooser.setFileFilter(fex);
  100.             jfilechooser.setAcceptAllFileFilterUsed(acceptall);
  101.             return jfilechooser;
  102.         }
  103.         public javax.swing.JTextField JTextField(Font font, Color foreground, Color background, Integer columns, Integer[] bounds){
  104.             javax.swing.JTextField jtextfield = new javax.swing.JTextField();
  105.             jtextfield.setColumns(columns);
  106.             jtextfield.setFont(font);
  107.             jtextfield.setForeground(foreground);
  108.             jtextfield.setBackground(background);
  109.             jtextfield.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  110.             return jtextfield;
  111.         }
  112.         public javax.swing.JProgressBar JProgressBar(Integer value, Color background, Boolean enabled, Boolean indeterminate, Integer[] bounds){
  113.             javax.swing.JProgressBar jprogressbar = new javax.swing.JProgressBar();
  114.             jprogressbar.setValue(value);
  115.             jprogressbar.setIndeterminate(indeterminate);
  116.             jprogressbar.setBackground(background);
  117.             jprogressbar.setEnabled(enabled);
  118.             jprogressbar.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  119.             return jprogressbar;
  120.         }
  121.         public javax.swing.JTextPane JTextPane(Font font, Color foreground, Color background, Boolean editable, String contenttype, Integer[] bounds){
  122.             javax.swing.JTextPane jtextpane = new javax.swing.JTextPane();
  123.             jtextpane.setFont(font);
  124.             jtextpane.setForeground(foreground);
  125.             jtextpane.setBackground(background);
  126.             jtextpane.setEditable(editable);
  127.             jtextpane.setContentType(contenttype);
  128.             jtextpane.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  129.             return jtextpane;
  130.         }
  131.         public javax.swing.JScrollPane JScrollPane(Integer verticalscrollpolicy, Integer horizontalscrollpolicy){
  132.             javax.swing.JScrollPane jscrollpane = new javax.swing.JScrollPane();
  133.             jscrollpane.setVerticalScrollBarPolicy(verticalscrollpolicy);
  134.             jscrollpane.setHorizontalScrollBarPolicy(horizontalscrollpolicy);
  135.             return jscrollpane;
  136.         }
  137.     }
  138.  
  139.  
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement