📄 yxkc.java
字号:
package gui;import com.cloudgarden.layout.AnchorLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.ArrayList;import java.util.List;import javax.swing.JButton;import javax.swing.JScrollPane;import javax.swing.JTextArea;import com.cloudgarden.layout.AnchorConstraint;import edu.sist200.model.Course;import edu.sist200.model.Student;import edu.sist200.services.BussinessServices;import javax.swing.JLabel;import javax.swing.WindowConstants;/*** This code was generated using CloudGarden's Jigloo* SWT/Swing GUI Builder, which is free for non-commercial* use. If Jigloo is being used commercially (ie, by a corporation,* company or business for any purpose whatever) then you* should purchase a license for each developer using Jigloo.* Please visit www.cloudgarden.com for details.* Use of Jigloo implies acceptance of these licensing terms.* ************************************** A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED* for this machine, so Jigloo or this code cannot be used legally* for any corporate or commercial purpose.* **************************************/public class YXKC extends javax.swing.JFrame { private JLabel jLabel1; private JButton jButton1; private JTextArea jTextArea1; static YXKC inst; Student stu=new Student(); /** * Auto-generated main method to display this JFrame */ public static void main(String[] args) { inst= new YXKC(); inst.setVisible(true); } public YXKC() { super(); initGUI(); } public YXKC(Student stu) { super(); initGUI(); this.stu=stu; } public void setInst(YXKC inst){ this.inst=inst; inst.setLocation((1024-612)/2, (768-372)/2); BussinessServices bs=new BussinessServices(); List rs=bs.queryStuCou(stu); int t=1; JScrollPane jsp = new JScrollPane(jTextArea1); jsp.setBounds(30,40,500,200); this.getContentPane().add(jsp); if(rs==null) { DLCG m=new DLCG(stu); m.setVisible(true); m.setInst(m); inst.setVisible(false); rs=new ArrayList(); } else { for(int i=0;i<rs.size();i++) { Course course = (Course) rs.get(i); jTextArea1.append(">>>>>>>您选的第"+t+"号课程号情况如下:"+'\n'); jTextArea1.append(">>>>>>>课程名:"+course.getCname()+'\n'); jTextArea1.append(">>>>>>>授课老师:"+course.getCteacher()+'\n'); jTextArea1.append(">>>>>>>授课地点:"+course.getCaddress()+'\n'); jTextArea1.append(">>>>>>>学生总数:"+course.getTotalstu()+"\n"); jTextArea1.append(">>>>>>>当前学生数:"+course.getNowstu()+"\n"); jTextArea1.append("***********************************"+"\n"); t++; } } } private void initGUI() { try { AnchorLayout thisLayout = new AnchorLayout(); this.getContentPane().setLayout(thisLayout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jButton1 = new JButton(); this.getContentPane().add( jButton1, new AnchorConstraint( 858, 893, 958, 753, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jButton1.setText("\u8fd4\u56de"); jButton1.setPreferredSize(new java.awt.Dimension(76, 30)); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { DLCG m=new DLCG(stu); m.setVisible(true); m.setInst(m); inst.setVisible(false); } }); } { jTextArea1 = new JTextArea(); this.getContentPane().add( jTextArea1, new AnchorConstraint( 141, 934, 812, 72, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextArea1.setPreferredSize(new java.awt.Dimension(467, 202)); jTextArea1.setEditable(false); jTextArea1.setRows(100); } { jLabel1 = new JLabel(); this.getContentPane().add( jLabel1, new AnchorConstraint( 44, 342, 144, 48, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel1.setText("\u60a8\u5df2\u7ecf\u9009\u4e86\u4ee5\u4e0b\u8bfe\u7a0b\uff1a"); jLabel1.setPreferredSize(new java.awt.Dimension(159, 30)); } pack(); this.setSize(584, 342); } catch (Exception e) { e.printStackTrace(); } } /** * Auto-generated method for setting the popup menu for a component */ private void setComponentPopupMenu(final java.awt.Component parent, final javax.swing.JPopupMenu menu) {parent.addMouseListener(new java.awt.event.MouseAdapter() {public void mousePressed(java.awt.event.MouseEvent e) {if(e.isPopupTrigger())menu.show(parent, e.getX(), e.getY());}public void mouseReleased(java.awt.event.MouseEvent e) {if(e.isPopupTrigger())menu.show(parent, e.getX(), e.getY());}}); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -