📄 cxkc.java
字号:
package gui;import com.cloudgarden.layout.AnchorLayout;import javax.swing.JButton;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.List;import javax.swing.JList;import javax.swing.JScrollPane;import javax.swing.ListModel;import javax.swing.DefaultComboBoxModel;import javax.swing.JTextArea;import com.cloudgarden.layout.AnchorConstraint;import edu.sist200.model.Course;import edu.sist200.model.Student;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 CXKC extends javax.swing.JFrame { private JLabel jLabel1; static CXKC inst; private JTextArea jTextArea1; private JButton jButton1; List l=null; JScrollPane jScrollPane1 = new JScrollPane(); int z=0; Student s=new Student(); /** * Auto-generated main method to display this JFrame */ public static void main(String[] args) { inst = new CXKC(); inst.setVisible(true); } public CXKC() { super(); initGUI(); } public CXKC(List l) { super(); this.l=l; initGUI(); JScrollPane jsp = new JScrollPane(jTextArea1); jsp.setBounds(30,40,550,200); this.getContentPane().add(jsp); for(int i=0;i<l.size();i++) { Course course = (Course) l.get(i); 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"); } } public void setInst(CXKC inst,int z){ this.inst=inst; this.z=z; inst.setLocation((1024-612)/2, (768-372)/2); } public void setStu(Student s) { this.s=s; } private void initGUI() { try { AnchorLayout thisLayout = new AnchorLayout(); this.getContentPane().setLayout(thisLayout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jTextArea1 = new JTextArea(); this.getContentPane().add( jTextArea1); jTextArea1.setPreferredSize(new java.awt.Dimension(523, 212)); jTextArea1.setEditable(false); jTextArea1.setRows(100); jTextArea1.setWrapStyleWord(true); } { jButton1 = new JButton(); this.getContentPane().add( jButton1, new AnchorConstraint( 841, 865, 930, 729, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jButton1.setText("\u8fd4\u56de"); jButton1.setPreferredSize(new java.awt.Dimension(82, 30)); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (z==1) { JsJFrame m=new JsJFrame(); m.setVisible(true); m.setInst(m); inst.setVisible(false); } else { DLCG m=new DLCG(s); m.setVisible(true); m.setInst(m); inst.setVisible(false); } } }); } { jLabel1 = new JLabel(); this.getContentPane().add( jLabel1, new AnchorConstraint( 36, 224, 125, 52, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel1.setText("\u73b0\u5728\u6709\u7684\u8bfe\u7a0b\uff1a"); jLabel1.setPreferredSize(new java.awt.Dimension(104, 30)); } pack(); this.setSize(612, 372); } 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 + -