/* * Creates the JTextArea for the GUI with the ScrollPane. */ private JScrollPane responseArea() { responseArea = new JTextArea(); responseArea.setSize(10, 10); responseArea.setLineWrap(true); responseArea.setWrapStyleWord(true); scrollPane = new JScrollPane( responseArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); return scrollPane; }
/** Create and add Clippy's output text */ public void addClippyTxt() { clippyTxt.setLineWrap(true); clippyTxt.setWrapStyleWord(true); clippyTxt.setEditable(false); clippyTxt.setFont(txtFont); clippyTxt.setAlignmentX(JTextArea.CENTER_ALIGNMENT); clippyTxt.setAlignmentY(JTextArea.CENTER_ALIGNMENT); clippyTxt.setBorder(null); clippyTxt.setSize(105, 35); clippyTxt.setLocation(25, 45); clippyTxt.setOpaque(false); lpane.add(clippyTxt, new Integer(1), 0); }
private void dialog(String title, String cad) { JScrollPane scr = new JScrollPane(); scr.setSize(300, 500); JDialog dialogo = new JDialog(); dialogo.setTitle(title); JTextArea area = new JTextArea(); dialogo.setSize(300, 500); area.setSize(300, 500); scr.setViewportView(area); dialogo.add(scr); area.setText(cad); dialogo.setVisible(true); }
/** Initialisation */ private void initComponents() { setBackground(new java.awt.Color(114, 159, 255)); addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(); } }); getContentPane().setLayout(new java.awt.BorderLayout()); JPanel actionPanel = new JPanel(); actionPanel.setLayout(new java.awt.GridLayout(1, 0)); detailedArea.setEditable(false); detailedArea.setVisible(true); detailedArea.setSize(500, 300); detailedArea.setFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 11)); StringWriter opDetail = new StringWriter(); actionPrint(new PrintWriter(opDetail)); detailedArea.setText(new String(opDetail.getBuffer())); JScrollPane scroll = new JScrollPane(detailedArea); actionPanel.add(scroll); getContentPane().add(actionPanel, "Center"); northToolBar = new javax.swing.JToolBar(); northToolBar.setLayout(new java.awt.FlowLayout()); northToolBar.setFloatable(false); jbn_Print = new javax.swing.JButton(); jbn_Print.setText(" Print "); jbn_Print.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbn_PrintActionPerformed(); } }); northToolBar.add(jbn_Print); jbn_OK = new javax.swing.JButton(); jbn_OK.setText(" Close "); jbn_OK.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbn_OKActionPerformed(); } }); northToolBar.add(jbn_OK); getContentPane().add(northToolBar, "South"); }
/* **构造函数 */ public AboutDialog() { setTitle("蜘蛛牌"); setSize(300, 200); setResizable(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container c = this.getContentPane(); jt1.setSize(260, 200); jt2.setSize(260, 200); jt1.setEditable(false); jt2.setEditable(false); jt1.setLineWrap(true); jt2.setLineWrap(true); jt1.setFont(new Font("楷体_GB2312", java.awt.Font.BOLD, 13)); jt1.setForeground(Color.blue); jt2.setFont(new Font("楷体_GB2312", java.awt.Font.BOLD, 13)); jt2.setForeground(Color.black); jPanel1.add(jt1); jPanel2.add(jt2); jTabbedPane.setSize(300, 200); jTabbedPane.addTab("游戏规则", null, jPanel1, null); jTabbedPane.addTab("声明", null, jPanel2, null); jMainPane.add(jTabbedPane); c.add(jMainPane); pack(); this.setVisible(true); }
public GraphicsUI() { questionPool = new QuestionPool(); setTitle("Question Pool"); setSize(WIDTH, HEIGHT); fileL = new JLabel("Location of Question Pool File:"); fileTF = new JTextField(10); checkB = new JButton("Check File"); log = new JTextArea(6, 30); Container pane = getContentPane(); pane.setLayout(null); // set locations and sizes for the elements fileL.setLocation(90, 15); fileL.setSize(ELEMENT_WIDTH, 30); fileTF.setLocation(90, 65); fileTF.setSize(ELEMENT_WIDTH, 30); checkB.setLocation(90, 105); checkB.setSize(300, 35); log.setLocation(90, 145); log.setSize(300, 30); // add listener to button CheckButtonHandler cbHandler = new CheckButtonHandler(); checkB.addActionListener(cbHandler); fileTF.addActionListener(cbHandler); // add elements to pane pane.add(fileL); pane.add(fileTF); pane.add(checkB); pane.add(log); setLocation(100, 60); setVisible(true); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
MovieAdd() { setTitle("Dodaj Film"); setSize(300, 355); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); this.setResizable(false); setLayout(null); frame = this; /** ***************************************************** */ Mov = DataBase.getInstance().getMoviesDao(); Cat = DataBase.getInstance().getCategoriesDao(); CatMov = DataBase.getInstance().getCatMovDao(); Vector<String> catNamesList = DataBase.returnCategoriesList(); /** ******************************************************* */ categories = new JComboBox(catNamesList); label1.setLocation(10, 10); label1.setSize(60, 25); categories.setLocation(80, 10); categories.setSize(200, 25); label2.setLocation(10, 50); label2.setSize(60, 25); name.setLocation(80, 50); name.setSize(200, 25); label3.setLocation(10, 90); label3.setSize(60, 25); desc.setLocation(80, 90); desc.setSize(200, 150); desc.setFont(new Font("Dialog", Font.PLAIN, 12)); label4.setLocation(10, 250); label4.setSize(60, 25); fileButton.setLocation(80, 250); fileButton.setSize(200, 25); button.setLocation(220, 290); button.setSize(60, 25); add(label1); add(categories); add(label2); add(name); add(label3); add(desc); add(label4); add(fileButton); add(button); fileButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int returnVal = fileChooser.showOpenDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { choosenFileName = fileChooser.getSelectedFile().getAbsolutePath(); } } }); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Movies newMovie = new Movies(); newMovie.setName(name.getText()); newMovie.setContent(desc.getText()); newMovie.setFile(choosenFileName); newMovie.setCreated(new Date()); try { Mov.create(newMovie); } catch (SQLException ex) { System.out.println("Błąd przy zapisywaniu nowego filmu... MovieAdd " + ex); } String catName = (String) categories.getSelectedItem(); Categories category = new Categories(); try { category = Cat.queryForEq("name", catName).get(0); } catch (SQLException ex) { System.out.println("Błąd przy szukaniu kategorii... MovieAdd " + ex); } CatMovies catMovLink = new CatMovies(); catMovLink.setMovie(newMovie); catMovLink.setCategory(category); try { CatMov.create(catMovLink); } catch (SQLException ex) { System.out.println("Błąd przy zapisywaniu kategoria-film... MovieAdd " + ex); } frame.setVisible(false); } }); }
// constructor public Login() { // create top panel top = new JPanel(); top.setBackground(Color.WHITE); top.setLayout(new BorderLayout()); ImageIcon banner = new ImageIcon("images/bannerLOGIN.png"); bannerImg = new JLabel(banner); top.add(bannerImg, BorderLayout.NORTH); // create middle panels // midleft mid = new JPanel(); mid.setBackground(Color.WHITE); mid.setLayout(new GridLayout(2, 2)); JPanel topLeft = new JPanel(); JPanel topRight = new JPanel(); JPanel btmLeft = new JPanel(); JPanel btmRight = new JPanel(); username = new JLabel(); username.setText("E-Mail Address"); username.setFont(new Font("Courier", Font.BOLD, 16)); topLeft.setLayout(new BorderLayout()); topLeft.setBackground(Color.WHITE); topLeft.add(username, BorderLayout.CENTER); password = new JLabel(); password.setText("Password"); password.setFont(new Font("Courier", Font.BOLD, 16)); btmLeft.setLayout(new BorderLayout()); btmLeft.setBackground(Color.WHITE); btmLeft.add(password, BorderLayout.CENTER); JPanel panelA = new JPanel(); panelA.setBackground(Color.WHITE); JPanel panelB = new JPanel(); panelB.setBackground(Color.WHITE); JPanel panelC = new JPanel(); panelC.setBackground(Color.WHITE); panelB.setLayout(new BorderLayout()); username1 = new JTextArea(); username1.setSize(new Dimension(5, 15)); panelB.add(username1, BorderLayout.CENTER); topRight.setLayout(new GridLayout(3, 1)); topRight.add(panelA); topRight.add(panelB); topRight.add(panelC); JPanel panelD = new JPanel(); panelD.setBackground(Color.WHITE); JPanel panelE = new JPanel(); panelE.setBackground(Color.WHITE); JPanel panelF = new JPanel(); panelF.setBackground(Color.WHITE); panelE.setLayout(new BorderLayout()); password1 = new JTextArea(); panelE.add(password1, BorderLayout.CENTER); btmRight.setLayout(new GridLayout(3, 1)); btmRight.add(panelD); btmRight.add(panelE); btmRight.add(panelF); mid.add(topLeft); mid.add(topRight); mid.add(btmLeft); mid.add(btmRight); // bottom panel // this is where the log on button will go btm = new JPanel(); btm.setBackground(Color.WHITE); logon = new JButton(); logon.setText("Log in"); logon.setFont(new Font("Courier", Font.BOLD, 16)); logon.setPreferredSize(new Dimension(100, 50)); logon.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { new Home(); getLogin().setVisible(false); } }); btm.add(logon); // create index panel loginPanel = new JPanel(); loginPanel.setLayout(new GridLayout(3, 1)); loginPanel.setBackground(Color.WHITE); // add panels to index panel loginPanel.add(top); loginPanel.add(mid); loginPanel.add(btm); // create Frame login = new JFrame(); login.setTitle("Log in"); login.setSize(500, 500); login.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); login.setVisible(true); // add panels to frame login.add(loginPanel); }
/** ** Constructor. Sets up user interface and initializations */ public Secondtry() { operators = true; doClear = false; frame = new JFrame("Calculator"); frame.setLayout(new BorderLayout(10, 10)); display = new JTextArea(); display.setSize(245, 100); display.setFont(new Font("SansSerif", Font.BOLD, 28)); display.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); // create the numeric buttons for calculator for (int i = 0; i < 10; i++) { jb[i] = new JButton("" + (i)); jb[i].addActionListener(this); jb[i].setFont(new Font("SansSerif", Font.BOLD, 14)); } // create the square root button root = new JButton("\u221A"); root.addActionListener(this); root.setFont(new Font("SansSerif", Font.BOLD, 14)); // create the clear button clear = new JButton("C"); clear.addActionListener(this); clear.setFont(new Font("SansSerif", Font.BOLD, 14)); // create the plus button plus = new JButton("\u002B"); plus.addActionListener(this); plus.setFont(new Font("SansSerif", Font.BOLD, 14)); // create the minus button minus = new JButton("\u002D"); minus.addActionListener(this); minus.setFont(new Font("SansSerif", Font.BOLD, 14)); // create the multiply button mult = new JButton("\u002A"); mult.addActionListener(this); mult.setFont(new Font("SansSerif", Font.BOLD, 14)); // create the division button div = new JButton("\u002F"); div.addActionListener(this); div.setFont(new Font("SansSerif", Font.BOLD, 14)); // create the equals button equals = new JButton("\u003D"); equals.addActionListener(this); equals.setFont(new Font("SansSerif", Font.BOLD, 14)); equals.setPreferredSize(new Dimension(50, 60)); // create the point button point = new JButton("\u002E"); point.addActionListener(this); point.setFont(new Font("SansSerif", Font.BOLD, 14)); // button grid JPanel buttons = new JPanel(new GridLayout(5, 4, 4, 4)); // add buttons to grid buttons.add(clear); buttons.add(root); buttons.add(div); buttons.add(mult); // add numeric buttons to grid for (int i = 7; i < 10; i++) buttons.add(jb[i]); buttons.add(minus); // add numeric buttons to grid for (int i = 4; i < 7; i++) buttons.add(jb[i]); buttons.add(plus); // add numeric buttons to grid for (int i = 1; i < 4; i++) buttons.add(jb[i]); buttons.add(equals); buttons.add(jb[0]); buttons.add(point); frame.add(display, BorderLayout.CENTER); frame.add(buttons, BorderLayout.SOUTH); frame.setSize(300, 400); frame.setVisible(true); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public Reflexology2() { frame.setSize(615, 455); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Reflexology 2.0"); frame.setResizable(false); frame2.setSize(600, 475); frame2.setLocationRelativeTo(null); frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame2.setTitle("Reflexology 2.0"); frame2.setResizable(false); frame3.setSize(600, 475); frame3.setLocationRelativeTo(null); frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame3.setTitle("Reflexology Survey"); frame3.setResizable(false); button1 = new JButton("Accept"); button2 = new JButton("Decline"); // movingButton = new JButton("Click Me"); ListenForAcceptButton lForAButton = new ListenForAcceptButton(); ListenForDeclineButton lForDButton = new ListenForDeclineButton(); button1.addActionListener(lForAButton); button2.addActionListener(lForDButton); // movingButton.addActionListener(lForMButton); textArea1.setText("Tracking Events\n"); textArea1.setLineWrap(true); textArea1.setWrapStyleWord(true); textArea1.setSize(15, 50); textArea1.setEditable(false); FileReader reader = null; try { reader = new FileReader("EULA.txt"); textArea1.read(reader, "EULA.txt"); } catch (IOException exception) { System.err.println("Problem loading file"); exception.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException exception) { System.err.println("Error closing reader"); exception.printStackTrace(); } } } AdjustmentListener sListener = new MyAdjustmentListener(); scrollBar1.getVerticalScrollBar().addAdjustmentListener(sListener); thePanel.add(scrollBar1); button1.setEnabled(false); thePanel.add(button1); thePanel.add(button2); frame.add(thePanel); ListenForMouse lForMouse = new ListenForMouse(); thePlacebo.addMouseListener(lForMouse); label1.setFont(font); thePlacebo.add(label1); frame2.add(thePlacebo); ListenForWindow lForWindow = new ListenForWindow(); frame.addWindowListener(lForWindow); frame2.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == 'X' || e.getKeyChar() == 'x') { moveBallTimer.start(); } } }); frame.setVisible(true); moveBallTimer = new Timer( 900, new ActionListener() { public void actionPerformed(ActionEvent e) { moveBall(); // System.out.println("Timer started!"); repaint(); } }); addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (frame2.isVisible()) { moveBallTimer.start(); } } }); setFont(new Font("Tahoma", Font.PLAIN, 11)); panelSurv1.setFont(new Font("Tahoma", Font.PLAIN, 11)); frame3.getContentPane().setLayout(new CardLayout(0, 0)); frame3.getContentPane().add(panelSurv1, ""); panelSurv1.setLayout(null); /* frame3.setVisible(true); frame3.setSize(600, 475); frame3.setResizable(false); frame3.setLocationRelativeTo(null); frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); */ JLabel lblNewLabel = new JLabel("How old are you?"); lblNewLabel.setBounds(22, 26, 112, 14); panelSurv1.add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("Select your gender:"); lblNewLabel_1.setBounds(366, 37, 115, 14); panelSurv1.add(lblNewLabel_1); JLabel lblNewLabel_2 = new JLabel("Current class level:"); lblNewLabel_2.setBounds(22, 56, 112, 14); panelSurv1.add(lblNewLabel_2); String[] classLevel = { "", "Freshman", "Sophomore", "Junior", "Senior", "Senior+", "Graduate Student", "Other" }; cmbClass = new JComboBox(classLevel); cmbClass.setName(""); cmbClass.setBounds(144, 53, 195, 20); panelSurv1.add(cmbClass); JLabel lblWhatIsYour = new JLabel("What is your major or field?"); lblWhatIsYour.setBounds(22, 102, 161, 14); panelSurv1.add(lblWhatIsYour); txtMajor = new JTextField(); txtMajor.setName(""); txtMajor.setColumns(10); txtMajor.setBounds(193, 99, 347, 20); panelSurv1.add(txtMajor); JLabel lblDidYouRead = new JLabel("Did you read the license agreement before installing Reflexology?"); lblDidYouRead.setBounds(22, 143, 392, 14); panelSurv1.add(lblDidYouRead); JLabel lblIfTheLicensing = new JLabel( "If the licensing agreement raised any privacy concerns, please type them below:"); lblIfTheLicensing.setBounds(22, 178, 503, 14); panelSurv1.add(lblIfTheLicensing); JLabel lblToHowMany = new JLabel("Up to how many friends may you gift Reflexology?"); lblToHowMany.setBounds(22, 247, 303, 14); panelSurv1.add(lblToHowMany); String[] numGifts = {"", "Don't know", "0", "1", "2", "3", "4"}; cmbNumGifts = new JComboBox(numGifts); cmbNumGifts.setBounds(320, 244, 205, 20); panelSurv1.add(cmbNumGifts); JLabel lblReflexologyProvidesThe = new JLabel("Reflexology provides the following warranty:"); lblReflexologyProvidesThe.setBounds(22, 280, 254, 14); panelSurv1.add(lblReflexologyProvidesThe); String[] theWarranty = { "", "Don't know", "Won't harm my computer", "Doesn't have viruses", "Money back guarantee", "None" }; cmbWarranty = new JComboBox(theWarranty); cmbWarranty.setBounds(296, 277, 157, 20); panelSurv1.add(cmbWarranty); JLabel lblWhoOwnsIntellectual = new JLabel("Who owns intellectual property created with Reflexology?"); lblWhoOwnsIntellectual.setBounds(22, 316, 372, 14); panelSurv1.add(lblWhoOwnsIntellectual); String[] IPOwner = { "", "Don't know", "Me", "The researchers", "Penn State", "Reflexology programmers" }; cmbIPOwner = new JComboBox(IPOwner); cmbIPOwner.setBounds(408, 313, 157, 20); panelSurv1.add(cmbIPOwner); btnPage2.setBounds(340, 400, 89, 23); panelSurv1.add(btnPage2); JLabel lblNewLabel_3 = new JLabel("*WARNING* You cannot return to these answers."); lblNewLabel_3.setForeground(Color.RED); lblNewLabel_3.setBounds(35, 404, 277, 14); panelSurv1.add(lblNewLabel_3); String[] gender = {"", "M", "F"}; cmbGender = new JComboBox(gender); cmbGender.setBounds(491, 34, 70, 20); panelSurv1.add(cmbGender); String[] didRead = {"", "Yes", "No"}; cmbDidRead = new JComboBox(didRead); cmbDidRead.setBounds(424, 140, 98, 20); panelSurv1.add(cmbDidRead); spnAge = new JSpinner(); spnAge.setModel(new SpinnerNumberModel(1, 1, 111, 1)); spnAge.setBounds(148, 23, 47, 20); panelSurv1.add(spnAge); txtPrivacyConcerns = new JTextField(); txtPrivacyConcerns.setName(""); txtPrivacyConcerns.setColumns(10); txtPrivacyConcerns.setBounds(22, 204, 547, 23); panelSurv1.add(txtPrivacyConcerns); frame3.getContentPane().add(panelSurv2, ""); panelSurv2.setLayout(null); JLabel lblNewLabel_4 = new JLabel("Estimate your overall comprehension of the License Agreement:"); lblNewLabel_4.setBounds(20, 18, 386, 14); panelSurv2.add(lblNewLabel_4); sldComp = new JSlider(); sldComp.setMajorTickSpacing(1); sldComp.setPaintTicks(true); sldComp.setPaintLabels(true); sldComp.setSnapToTicks(true); sldComp.setValue(-1); sldComp.setMinorTickSpacing(1); sldComp.setMinimum(1); sldComp.setMaximum(5); sldComp.setBounds(154, 43, 274, 45); panelSurv2.add(sldComp); JLabel lblNewLabel_5 = new JLabel("No comprehension"); lblNewLabel_5.setHorizontalAlignment(SwingConstants.RIGHT); lblNewLabel_5.setBounds(20, 43, 124, 25); panelSurv2.add(lblNewLabel_5); JLabel lblNewLabel_6 = new JLabel("Perfect Comprehension"); lblNewLabel_6.setBounds(438, 43, 138, 25); panelSurv2.add(lblNewLabel_6); JLabel lblIEnjoyUsing = new JLabel("I enjoy using technological applications (apps):"); lblIEnjoyUsing.setBounds(20, 99, 386, 14); panelSurv2.add(lblIEnjoyUsing); JLabel lblStronglyDisagree = new JLabel("Strongly disagree"); lblStronglyDisagree.setHorizontalAlignment(SwingConstants.RIGHT); lblStronglyDisagree.setBounds(20, 124, 124, 25); panelSurv2.add(lblStronglyDisagree); sldEnjoyTech = new JSlider(); sldEnjoyTech.setValue(-1); sldEnjoyTech.setSnapToTicks(true); sldEnjoyTech.setPaintTicks(true); sldEnjoyTech.setPaintLabels(true); sldEnjoyTech.setMinorTickSpacing(1); sldEnjoyTech.setMinimum(1); sldEnjoyTech.setMaximum(5); sldEnjoyTech.setMajorTickSpacing(1); sldEnjoyTech.setBounds(154, 124, 274, 45); panelSurv2.add(sldEnjoyTech); JLabel lblStronglyAgree = new JLabel("Strongly agree"); lblStronglyAgree.setBounds(438, 124, 138, 25); panelSurv2.add(lblStronglyAgree); JLabel lblIAmGood = new JLabel("I am good at using technological applications (apps):"); lblIAmGood.setBounds(20, 180, 386, 14); panelSurv2.add(lblIAmGood); sldUseTech = new JSlider(); sldUseTech.setValue(-1); sldUseTech.setSnapToTicks(true); sldUseTech.setPaintTicks(true); sldUseTech.setPaintLabels(true); sldUseTech.setMinorTickSpacing(1); sldUseTech.setMinimum(1); sldUseTech.setMaximum(5); sldUseTech.setMajorTickSpacing(1); sldUseTech.setBounds(154, 205, 274, 45); panelSurv2.add(sldUseTech); JLabel lblHowOftenDo = new JLabel("My friends ask me for computer and technology advice:"); lblHowOftenDo.setBounds(20, 261, 386, 14); panelSurv2.add(lblHowOftenDo); sldFriendsTech = new JSlider(); sldFriendsTech.setValue(-1); sldFriendsTech.setSnapToTicks(true); sldFriendsTech.setPaintTicks(true); sldFriendsTech.setPaintLabels(true); sldFriendsTech.setMinorTickSpacing(1); sldFriendsTech.setMinimum(1); sldFriendsTech.setMaximum(5); sldFriendsTech.setMajorTickSpacing(1); sldFriendsTech.setBounds(154, 286, 274, 45); panelSurv2.add(sldFriendsTech); JLabel label_1 = new JLabel("Strongly disagree"); label_1.setHorizontalAlignment(SwingConstants.RIGHT); label_1.setBounds(20, 205, 124, 25); panelSurv2.add(label_1); JLabel label_2 = new JLabel("Strongly disagree"); label_2.setHorizontalAlignment(SwingConstants.RIGHT); label_2.setBounds(20, 286, 124, 25); panelSurv2.add(label_2); JLabel label_3 = new JLabel("Strongly agree"); label_3.setBounds(438, 205, 138, 25); panelSurv2.add(label_3); JLabel label_4 = new JLabel("Strongly agree"); label_4.setBounds(438, 286, 138, 25); panelSurv2.add(label_4); JLabel label_5 = new JLabel("*WARNING* You cannot return to these answers."); label_5.setForeground(Color.RED); label_5.setBounds(80, 382, 277, 14); panelSurv2.add(label_5); btnPage3.setBounds(385, 378, 89, 23); panelSurv2.add(btnPage3); frame3.getContentPane().add(panelSurv3, ""); panelSurv3.setLayout(null); JLabel lblNewLabel_7 = new JLabel("Is there anything you enjoyed about the license agreement?"); lblNewLabel_7.setBounds(10, 11, 349, 14); panelSurv3.add(lblNewLabel_7); txtEnjoyedLic = new JTextField(); txtEnjoyedLic.setBounds(364, 8, 220, 20); panelSurv3.add(txtEnjoyedLic); txtEnjoyedLic.setColumns(10); JLabel lblNewLabel_8 = new JLabel("When you install reflexology, who are you entering an agreement with?"); lblNewLabel_8.setBounds(10, 36, 412, 14); panelSurv3.add(lblNewLabel_8); String[] whoAgree = { "", "Don't know", "State of PA", "Penn State", "PA Court of Common Pleas", "PA District Court", "Reflexology Development Team" }; cmbWhoAgree = new JComboBox(whoAgree); cmbWhoAgree.setBounds(432, 33, 152, 20); panelSurv3.add(cmbWhoAgree); JLabel lblTheLicenseAgreement = new JLabel("The license agreement applies to the following types of media:"); lblTheLicenseAgreement.setBounds(10, 61, 368, 14); panelSurv3.add(lblTheLicenseAgreement); String[] mediaTypes = { "", "Don't know", "Software", "Digital Media Content", "Print Material", "Documentation", "All of the above" }; cmbMediaTypes = new JComboBox(mediaTypes); cmbMediaTypes.setBounds(388, 61, 196, 20); panelSurv3.add(cmbMediaTypes); JLabel lblNewLabel_9 = new JLabel("Is it possible to purchase the Reflexology software? (explain below)"); lblNewLabel_9.setBounds(10, 86, 566, 14); panelSurv3.add(lblNewLabel_9); txtPurchasing = new JTextField(); txtPurchasing.setBounds(10, 111, 574, 20); panelSurv3.add(txtPurchasing); txtPurchasing.setColumns(10); JLabel lblTheLicenseAgreement_1 = new JLabel("The license agreement was visually appealing"); lblTheLicenseAgreement_1.setBounds(20, 145, 386, 14); panelSurv3.add(lblTheLicenseAgreement_1); JLabel label_7 = new JLabel("Strongly disagree"); label_7.setHorizontalAlignment(SwingConstants.RIGHT); label_7.setBounds(20, 170, 124, 25); panelSurv3.add(label_7); sldAesthetics = new JSlider(); sldAesthetics.setValue(-1); sldAesthetics.setSnapToTicks(true); sldAesthetics.setPaintTicks(true); sldAesthetics.setPaintLabels(true); sldAesthetics.setMinorTickSpacing(1); sldAesthetics.setMinimum(1); sldAesthetics.setMaximum(5); sldAesthetics.setMajorTickSpacing(1); sldAesthetics.setBounds(154, 170, 274, 45); panelSurv3.add(sldAesthetics); JLabel label_8 = new JLabel("Strongly agree"); label_8.setBounds(438, 170, 138, 25); panelSurv3.add(label_8); JLabel lblTheTextOf = new JLabel("This license agreement was easy to understand"); lblTheTextOf.setBounds(20, 226, 463, 14); panelSurv3.add(lblTheTextOf); JLabel label_10 = new JLabel("Strongly disagree"); label_10.setHorizontalAlignment(SwingConstants.RIGHT); label_10.setBounds(20, 251, 124, 25); panelSurv3.add(label_10); sldUnderstandLic = new JSlider(); sldUnderstandLic.setValue(-1); sldUnderstandLic.setSnapToTicks(true); sldUnderstandLic.setPaintTicks(true); sldUnderstandLic.setPaintLabels(true); sldUnderstandLic.setMinorTickSpacing(1); sldUnderstandLic.setMinimum(1); sldUnderstandLic.setMaximum(5); sldUnderstandLic.setMajorTickSpacing(1); sldUnderstandLic.setBounds(154, 251, 274, 45); panelSurv3.add(sldUnderstandLic); JLabel label_11 = new JLabel("Strongly agree"); label_11.setBounds(438, 251, 138, 25); panelSurv3.add(label_11); JLabel label_6 = new JLabel("Strongly disagree"); label_6.setHorizontalAlignment(SwingConstants.RIGHT); label_6.setBounds(20, 332, 124, 25); panelSurv3.add(label_6); sldAnnoyed = new JSlider(); sldAnnoyed.setValue(-1); sldAnnoyed.setSnapToTicks(true); sldAnnoyed.setPaintTicks(true); sldAnnoyed.setPaintLabels(true); sldAnnoyed.setMinorTickSpacing(1); sldAnnoyed.setMinimum(1); sldAnnoyed.setMaximum(5); sldAnnoyed.setMajorTickSpacing(1); sldAnnoyed.setBounds(154, 332, 274, 45); panelSurv3.add(sldAnnoyed); JLabel label_9 = new JLabel("Strongly agree"); label_9.setBounds(438, 332, 138, 25); panelSurv3.add(label_9); JLabel lblframe3LicenseAgreement = new JLabel("Something about this license agreement annoyed me"); lblframe3LicenseAgreement.setBounds(10, 304, 463, 14); panelSurv3.add(lblframe3LicenseAgreement); JLabel label_12 = new JLabel("*WARNING* You cannot return to these answers."); label_12.setForeground(Color.RED); label_12.setBounds(89, 404, 277, 14); panelSurv3.add(label_12); btnPage4.setBounds(394, 400, 89, 23); panelSurv3.add(btnPage4); frame3.getContentPane().add(panelSurv4, ""); panelSurv4.setLayout(null); JLabel lblNewLabel_10 = new JLabel("According to the license agreement, what does Penn State have "); lblNewLabel_10.setBounds(10, 11, 537, 14); panelSurv4.add(lblNewLabel_10); JLabel lblTheRightTo = new JLabel("the right to download from your computer?"); lblTheRightTo.setBounds(10, 26, 504, 14); panelSurv4.add(lblTheRightTo); txtPSUDownload = new JTextField(); txtPSUDownload.setBounds(10, 48, 553, 20); panelSurv4.add(txtPSUDownload); txtPSUDownload.setColumns(10); JLabel lblHowManyCopies = new JLabel("How many copies of Reflexology can you make for archival purposes?"); lblHowManyCopies.setBounds(10, 79, 438, 14); panelSurv4.add(lblHowManyCopies); String[] archCopies = {"", "Don't know", "0", "1", "3", "5", "Unlimited"}; cmbArchCopies = new JComboBox(archCopies); cmbArchCopies.setBounds(458, 79, 105, 20); panelSurv4.add(cmbArchCopies); JLabel lblYouCanLend = new JLabel("What can you do if you want to sue about Reflexology?"); lblYouCanLend.setBounds(10, 116, 323, 14); panelSurv4.add(lblYouCanLend); JLabel lblUnderWhatCircumstances = new JLabel("Under what circumstances can Penn State terminate your use of the software? "); lblUnderWhatCircumstances.setBounds(10, 184, 537, 14); panelSurv4.add(lblUnderWhatCircumstances); txtTerminate = new JTextField(); txtTerminate.setBounds(10, 209, 553, 20); panelSurv4.add(txtTerminate); txtTerminate.setColumns(10); sldTradKs = new JSlider(); sldTradKs.setValue(-1); sldTradKs.setSnapToTicks(true); sldTradKs.setPaintTicks(true); sldTradKs.setPaintLabels(true); sldTradKs.setMinorTickSpacing(1); sldTradKs.setMinimum(1); sldTradKs.setMaximum(5); sldTradKs.setMajorTickSpacing(1); sldTradKs.setBounds(154, 268, 274, 45); panelSurv4.add(sldTradKs); JLabel label_13 = new JLabel("Strongly disagree"); label_13.setHorizontalAlignment(SwingConstants.RIGHT); label_13.setBounds(20, 268, 124, 25); panelSurv4.add(label_13); JLabel label_14 = new JLabel("Strongly agree"); label_14.setBounds(438, 268, 138, 25); panelSurv4.add(label_14); JLabel lblPeopleAreMore = new JLabel( "People are more likely to read traditional contracts than software license agreemenets"); lblPeopleAreMore.setBounds(10, 240, 553, 14); panelSurv4.add(lblPeopleAreMore); JLabel lblwarningframe3Button = new JLabel("*WARNING* this button will instantly end the experiment ---->"); lblwarningframe3Button.setForeground(Color.RED); lblwarningframe3Button.setBounds(38, 400, 350, 14); panelSurv4.add(lblwarningframe3Button); btnDone.setBounds(398, 391, 89, 23); panelSurv4.add(btnDone); txtArbite = new JTextField(); txtArbite.setColumns(10); txtArbite.setBounds(10, 141, 553, 20); panelSurv4.add(txtArbite); ListenFor2Button lFor2Button = new ListenFor2Button(); ListenFor3Button lFor3Button = new ListenFor3Button(); ListenFor4Button lFor4Button = new ListenFor4Button(); ListenFor5Button lFor5Button = new ListenFor5Button(); btnPage2.addActionListener(lFor2Button); btnPage3.addActionListener(lFor3Button); btnPage4.addActionListener(lFor4Button); btnDone.addActionListener(lFor5Button); }
public Container StockSearchScreen() { StockSScreen.setLayout(new GridLayout(4, 0)); // Font for the title Font newFont = new Font("Aerial", Font.BOLD, 32); // Panels for the different parts of the screen. JPanel SearchP = new JPanel(); JPanel buttonP = new JPanel(); JPanel ResultP = new JPanel(); // ResultP.setLayout(new GridLayout(2,0)); SearchP.setLayout(new GridLayout(5, 0)); // Search text area // JTextField Searching = new JTextField("Input Search"); Days = new JTextField("number of days"); JLabel title = new JLabel("Rental"); title.setFont(newFont); // details.setPreferredSize(new Dimension(20,30)); // Results are put into textarea JTextArea results = new JTextArea("Results Displayed here"); results.setEditable(false); results.setSize(50, 2500); JLabel resultsa = new JLabel(); scroll = new JScrollPane(Films); Films.setLayoutOrientation(JList.VERTICAL); Films.setVisibleRowCount(5); Films.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); scroll.setPreferredSize(new Dimension(650, 150)); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); results.add(resultsa); // SearchP.add(Searching); SearchP.add(Searched); SearchP.add(Display_instock); ResultP.add(scroll); ResultP.add(Days); buttonP.add(confirm); buttonP.add(goBack); // Set the action listeners for the buttons Searched.addActionListener(this); cancel.addActionListener(this); goBack.addActionListener(this); confirm.addActionListener(this); Display_instock.addActionListener(this); StockSScreen.add(title); // ,BorderLayout.NORTH); StockSScreen.add(SearchP); // ,BorderLayout.CENTER); StockSScreen.add(ResultP); // ,BorderLayout.CENTER); StockSScreen.add(buttonP); // ,BorderLayout.SOUTH); return StockSScreen; }