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
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
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币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 动手学深度学习,沐神版配套代码,所有代码均可在jupyter中运行,内附有极为详尽的代码注释
- qaxbrowser-1.1.32574.52.exe (奇安信浏览器windows安装包)
- C#编写modbus tcp客户端读取modbus tcp服务器数据
- 某房地产瑞六补环境部分代码
- 基于Matlab实现无刷直流电机仿真(模型+说明文档).rar
- AllSort(直接插入排序,希尔排序,选择排序,堆排序,冒泡排序,快速排序,归并排序)
- 模拟qsort,改造冒泡排序使其能排序任意数据类型,即日常练习
- carsim+simulink联合仿真实现变道 包含路径规划算法+mpc轨迹跟踪算法 可选simulink版本和c++版本算法 可以适用于弯道道路,弯道车道保持,弯道变道 carsim内规划轨迹可视化
- 数组经典习题之顺序排序和二分查找和冒泡排序
- 永磁同步电机神经网络自抗扰控制,附带编程涉及到的公式文档,方便理解,模型顺利运行,效果好,位置电流双闭环采用二阶自抗扰控制,永磁同步电机三闭环控制,神经网络控制,自抗扰中状态扩张观测器与神经网络结合
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功