package editorstudent.editors;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
import dbconnection.DBConnection;
import entity.Content;
import entity.Student;
public class MyEditor extends EditorPart {
public static final String ID ="editorstudent.editors.MyEditor";
private Text text1;
private Text text2;
private Text text3;
private Text text4;
private Text text5;
private Text text6;
public MyEditor() {
// TODO Auto-generated constructor stub
}
@Override
public void doSave(IProgressMonitor monitor) {
// TODO Auto-generated method stub
}
@Override
public void doSaveAs() {
// TODO Auto-generated method stub
}
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
// TODO Auto-generated method stub
setSite(site);
setInput(input);
setPartName(input.getName());
}
@Override
public boolean isDirty() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isSaveAsAllowed() {
// TODO Auto-generated method stub
return false;
}
@Override
public void createPartControl(Composite parent) {
// TODO Auto-generated method stub
Composite container = new Composite(parent, SWT.BORDER);
String strNo = null;
String name = null;
String gender = null;
int age = 0;
String nativePlace = null;
String profession = null;
String stuNo = this.getTitle();
String select = "select * from student where stu_no = '" + stuNo + "'";
Connection conn = null;
Statement stmt = null;
try{
conn = DBConnection.getConnection();
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(select);
rs.next();
strNo = rs.getString(1);
name = rs.getString(2);
gender = rs.getString(3);
age = rs.getInt(4);
nativePlace = rs.getString(5);
profession = rs.getString(6);
}catch(SQLException e){
e.printStackTrace();
}
/*
GridLayout layout = new GridLayout();
layout.numColumns = 2;
parent.setLayout(layout);
Label label1 = new Label(container, SWT.NONE);
label1.setText("学号:");
label1.setBounds(10, 10, 100, 100);
Text text1 = new Text(container, SWT.BORDER);
text1.setText(strNo);
text1.setSize(100,30);
Label label2 = new Label(parent, SWT.BORDER);
label2.setText("姓名:");
Text text2 = new Text(container, SWT.BORDER);
text2.setText(name);
Label label3 = new Label(parent, SWT.BORDER);
label3.setText("性别:");
Text text3 = new Text(parent, SWT.BORDER);
text3.setText(gender);
Label label4 = new Label(parent, SWT.BORDER);
label4.setText("年龄:");
Text text4 = new Text(parent, SWT.BORDER);
String strage = "" + age;
text4.setText(strage);
Label label5 = new Label(parent, SWT.BORDER);
label5.setText("籍贯:");
Text text5 = new Text(parent, SWT.BORDER);
text5.setText(nativePlace);
Label label6 = new Label(parent, SWT.BORDER);
label6.setText("专业:");
Text text6 = new Text(parent, SWT.BORDER);
text6.setText(profession);
*/
Label label = new Label(container, SWT.NONE);
label.setBounds(10, 10, 40, 12);
label.setText("学号:");
Label label_1 = new Label(container, SWT.NONE);
label_1.setBounds(10, 49, 40, 12);
label_1.setText("姓名:");
Label label_2 = new Label(container, SWT.NONE);
label_2.setBounds(10, 88, 40, 19);
label_2.setText("性别:");
Label label_3 = new Label(container, SWT.NONE);
label_3.setBounds(10, 136, 40, 12);
label_3.setText("年龄:");
Label label_4 = new Label(container, SWT.NONE);
label_4.setBounds(10, 184, 40, 12);
label_4.setText("籍贯:");
Label label_5 = new Label(container, SWT.NONE);
label_5.setBounds(10, 227, 40, 12);
label_5.setText("专业:");
text1 = new Text(container, SWT.BORDER);
text1.setBounds(55, 4, 150, 18);
text1.setText(strNo);
text2 = new Text(container, SWT.BORDER);
text2.setBounds(55, 43, 150, 18);
text2.setText(name);
text3 = new Text(container, SWT.BORDER);
text3.setBounds(55, 85, 150, 18);
text3.setText(gender);
text4 = new Text(container, SWT.BORDER);
text4.setBounds(55, 130, 150, 18);
text4.setText(""+age);
text5 = new Text(container, SWT.BORDER);
text5.setBounds(55, 178, 150, 18);
text5.setText(nativePlace);
text6 = new Text(container, SWT.BORDER);
text6.setBounds(55, 221, 150, 18);
text6.setText(profession);
}
@Override
public void setFocus() {
// TODO Auto-generated method stub
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
RCP学生成绩管理系统项目源代码
共44个文件
class:18个
java:15个
gif:2个
5星 · 超过95%的资源 需积分: 10 41 下载量 56 浏览量
2011-03-06
11:37:24
上传
评论 1
收藏 765KB RAR 举报
温馨提示
我自己在RCP上开发的学生成绩管理系统,非常适合初学者,希望对需要的朋友有所帮助。
资源推荐
资源详情
资源评论
收起资源包目录
SIMS.rar (44个子文件)
SIMS
icons
alt_window_32.gif 1KB
alt_window_16.gif 637B
.project 861B
bin
editorstudent
content
MyLabel.class 2KB
MyContent.class 970B
editors
MyEditor.class 4KB
MyEditorInput.class 1KB
dbconnection
DBConnection.class 3KB
entity
Content.class 1KB
Student_Manage.class 2KB
Student.class 2KB
sims
View$1.class 798B
Perspective.class 792B
ApplicationActionBarAdvisor.class 3KB
View.class 2KB
ApplicationWorkbenchAdvisor.class 952B
Application$1.class 905B
Application.class 2KB
View$2.class 2KB
Activator.class 1KB
ApplicationWorkbenchWindowAdvisor.class 1KB
.settings
org.eclipse.jdt.core.prefs 629B
org.eclipse.ltk.core.refactoring.prefs 137B
META-INF
MANIFEST.MF 416B
src
editorstudent
content
MyLabel.java 1KB
MyContent.java 679B
editors
MyEditorInput.java 1KB
MyEditor.java 5KB
dbconnection
DBConnection.java 2KB
entity
Student_Manage.java 1KB
Content.java 1KB
Student.java 1KB
sims
ApplicationWorkbenchAdvisor.java 573B
View.java 4KB
Application.java 1KB
Activator.java 1KB
ApplicationWorkbenchWindowAdvisor.java 887B
Perspective.java 478B
ApplicationActionBarAdvisor.java 3KB
.classpath 470B
plugin.xml 1KB
lib
mysql-connector-java-5.1.12-bin.jar 716KB
splash.bmp 132KB
build.properties 299B
共 44 条
- 1
资源评论
- xu_876543212013-07-31非常好的资源,适合初学者,希望能有所帮助,谢谢楼主!
- willnetliu2013-12-03不错的资源,用简单的例子入门rcp
- WanTianwen2012-12-10这个系统确实是太简单了,只有一个显示学生的功能。
- nibushihenhaoma2012-08-22有了楼主这个RCP实例,学习RCP起来更加明细,谢谢楼主
- dlnuzwh2011-10-10很好的资源,对学RCP很有帮助
tianyong2011
- 粉丝: 32
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功