📄 sampleqqview.java
字号:
package com.hnjchina.example;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.ViewPart;
import com.hnjchina.example.qq.HideInvisibleComposite;
import com.hnjchina.example.qq.ResourceManager;
/**
* @author limeiyong
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class SampleQQView extends ViewPart{
private static Composite comp2;
private static Composite pane;
private static ScrolledComposite sc;
public void createPartControl(Composite parent) {
createQQ(parent);
}
private void createQQ(Composite parent){
final GridLayout gridLayout_2 = new GridLayout();
gridLayout_2.verticalSpacing = 0;
gridLayout_2.marginWidth = 0;
gridLayout_2.marginHeight = 0;
gridLayout_2.horizontalSpacing = 0;
parent.setLayout(gridLayout_2);
{
pane = new Composite(parent, SWT.NONE);
pane.setBackground(ResourceManager.getColor(236, 242, 252));
pane.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_CENTER | GridData.GRAB_VERTICAL
| GridData.VERTICAL_ALIGN_BEGINNING));
final GridLayout gridLayout_3 = new GridLayout();
gridLayout_3.verticalSpacing = 0;
gridLayout_3.marginWidth = 0;
gridLayout_3.marginHeight = 0;
gridLayout_3.horizontalSpacing = 0;
pane.setLayout(gridLayout_3);
{
final Label label = new Label(pane, SWT.NONE);
final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
label.setLayoutData(gridData);
// label.setImage(ResourceManager.getImage(FakeQQ.class,"number.bmp"));
}
{
comp2 = new HideInvisibleComposite(pane, SWT.NONE);
comp2.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
final GridLayout gridLayout = new GridLayout();
gridLayout.verticalSpacing = 0;
gridLayout.horizontalSpacing = 0;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
comp2.setLayout(gridLayout);
{
final Button button = new Button(comp2, SWT.NONE);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
sc.setVisible(!sc.isVisible());
pane.layout();
}
});
button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
button.setText("我的好友");
}
{
sc = new ScrolledComposite(comp2, SWT.V_SCROLL);
sc.setAlwaysShowScrollBars(true);
sc.setExpandVertical(true);
sc.setExpandHorizontal(true);
final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL| GridData.VERTICAL_ALIGN_FILL);
sc.setLayoutData(gridData);
sc.setLayout(new GridLayout());
{
final Composite composite_2 = new Composite(sc,SWT.NONE);
composite_2.setBackground(ResourceManager.getColor(236,242, 252));
final GridLayout gridLayout_1 = new GridLayout();
gridLayout_1.verticalSpacing = 3;
gridLayout_1.marginWidth = 3;
gridLayout_1.marginHeight = 3;
gridLayout_1.horizontalSpacing = 3;
composite_2.setLayout(gridLayout_1);
composite_2.setSize(30, 550);
sc.setContent(composite_2);
{
final Button button = new Button(composite_2,SWT.NONE);
// button.setImage(ResourceManager.getImage(FakeQQ.class, "logo1.bmp"));
final GridData gridData_1 = new GridData(GridData.GRAB_HORIZONTAL| GridData.HORIZONTAL_ALIGN_CENTER);
gridData_1.heightHint = 50;
gridData_1.widthHint = 50;
button.setLayoutData(gridData_1);
}
{
final Button button = new Button(composite_2,
SWT.NONE);
// button.setImage(ResourceManager.getImage(FakeQQ.class, "logo2.bmp"));
final GridData gridData_1 = new GridData(
GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_CENTER);
gridData_1.heightHint = 50;
gridData_1.widthHint = 50;
button.setLayoutData(gridData_1);
}
{
final Button button = new Button(composite_2,
SWT.NONE);
// button.setImage(ResourceManager.getImage(FakeQQ.class, "logo3.bmp"));
final GridData gridData_1 = new GridData(
GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_CENTER);
gridData_1.heightHint = 50;
gridData_1.widthHint = 50;
button.setLayoutData(gridData_1);
}
{
final Button button = new Button(composite_2,
SWT.NONE);
// button.setImage(ResourceManager.getImage(FakeQQ.class, "logo4.bmp"));
final GridData gridData_1 = new GridData(
GridData.HORIZONTAL_ALIGN_CENTER);
gridData_1.heightHint = 50;
gridData_1.widthHint = 50;
button.setLayoutData(gridData_1);
}
}
}
}
{
final Button button = new Button(pane, SWT.NONE);
button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
| GridData.VERTICAL_ALIGN_FILL));
button.setText("我的群");
}
{
final Button button = new Button(pane, SWT.NONE);
button.setLayoutData(new GridData(
GridData.HORIZONTAL_ALIGN_FILL));
button.setText("陌生人");
}
{
final Button button = new Button(pane, SWT.NONE);
button.setLayoutData(new GridData(
GridData.HORIZONTAL_ALIGN_FILL));
button.setText("黑名单");
}
}
}
public void setFocus() {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -