- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 SWT 中创建一个安装向导。
我有一些代码可以在复制文件时显示进度条。
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class SWT_Second {
public static Button b2;
public static Composite directoryInstComposite;
public static Composite workComposite;
public static Composite copyFilesComposite;
public static Label dir_entry_label;
public static Text dir_entry_text;
public static Label dir_info_label;
public static Button dir_next_button;
public static Button dir_cancel_button;
public static Button copy_next_button;
public static Button copy_cancel_button;
public static Shell shell;
public static ProgressBar pbar;
public static Display display;
public static File currentDir;
public static boolean copyFlag=false;
public static boolean actualCopyFlag=false;
public static boolean copySuccess=true;
public static int runWithoutAdminRights=-1;
public static Combo c1;
public static void main(String[] args) {
display = new Display();
shell = new Shell(display, SWT.CLOSE | SWT.TITLE | SWT.MIN |SWT.MAX| SWT.CENTER | SWT.SYSTEM_MODAL | SWT.
APPLICATION_MODAL);
shell.setSize(450,348);
shell.setLocation(250, 150);
shell.setText("Installer!");
shell.setLayout(new FormLayout());
final Image HKimage0=new Image(display,SWT_Second.class.getResourceAsStream("Img/d.png"));
shell.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(HKimage0, 0, 0);
}
});
shell.setImage(HKimage0);
Composite headerComposite = new Composite(shell, SWT.NONE);
headerComposite.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
FormData shellFormData = new FormData();
shellFormData.top=new FormAttachment(0,0);
shellFormData.left=new FormAttachment(00,0);
shellFormData.width=1364;
shellFormData.height=60;
headerComposite.setLayoutData(shellFormData);
Canvas prodName = new Canvas(headerComposite, SWT.NONE);
prodName.setBounds(6,6, 135,50);
prodName.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
Canvas canvas = new Canvas(headerComposite, SWT.NONE);
canvas.setSize(500,60);
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY));
e.gc.drawRectangle(3,3,437, 56);
}
});
final Image HKimage=new Image(display,SWT_Second.class.getResourceAsStream("Img/Logo_True_Colors.png"));
prodName.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(HKimage, 0, 0);
}
});
workComposite = new Composite(shell, SWT.NONE);
workComposite.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
FormData shellFormData1 = new FormData();
shellFormData1.top=new FormAttachment(0,53);
shellFormData1.left=new FormAttachment(00,0);
shellFormData1.width=1364;
shellFormData1.height=1000;
workComposite.setLayoutData(shellFormData1);
Canvas canvas1 = new Canvas(workComposite, SWT.NONE);
canvas1.setSize(500,230);
canvas1.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
canvas1.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY));
e.gc.drawRectangle(3,10,437, 219);
}
});
Canvas canvas2= new Canvas(workComposite, SWT.NONE);
canvas2.setSize(500,280);
canvas2.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
canvas2.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY));
e.gc.drawRectangle(3,233,437, 31);
}
});
final Label inst_wel_label = new Label(canvas1,SWT.NONE);
inst_wel_label.setText("Welcome to Setup");
Font boldFont = new Font( inst_wel_label.getDisplay(), new FontData( "TimesNewRoman", 16, SWT.BOLD ) );
inst_wel_label.setFont( boldFont );
inst_wel_label.setLocation(65, 50);
inst_wel_label.setSize(245, 25);
inst_wel_label.setAlignment(2);
final Label inst_type_label = new Label(canvas1,SWT.NONE);
inst_type_label.setText("Select Installation Type");
inst_type_label.setLocation(65,100);
inst_type_label.setSize(123, 25);
inst_type_label.setAlignment(2);
c1 = new Combo(canvas1, SWT.READ_ONLY);
c1.setBounds(205,100, 130,65);
c1.select(0);
String items[] = { "Dev User", "Operations User"};
c1.setItems(items);
c1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (c1.getText().equals("Dev User")) {
InstallUser="Dev User";
} else if (c1.getText().equals("Operations User")) {
InstallUser="Operations User";
} else {
InstallUser="NONE";
}
}
});
final Label inst_start_label = new Label(canvas1,SWT.NONE);
inst_start_label.setText("To start installation process, click Go");
inst_start_label.setLocation(65, 140);
inst_start_label.setSize(200,15);
Button b = new Button(canvas2, SWT.NONE);
b.setText("Go");
b.setSize(50, 20);
b.setLocation(310,240);
Button b1 = new Button(canvas2, SWT.NONE);
b1.setText("Cancel");
b1.setSize(50, 20);
b1.setLocation(365,240);
b1.addMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent arg0) {
}
@Override
public void mouseDown(MouseEvent arg0) {
System.exit(0);
}
@Override
public void mouseDoubleClick(MouseEvent arg0) {
}
});
i = 0;
workComposite.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent arg0) {
System.out.println("Inside Paint Listener " + new Date());
if(i==0) {
i++;
Date dt = null;
SimpleDateFormat st = null;
File checkAdminRightsFile = null;
try {
dt = new Date();
st = new SimpleDateFormat("yyyyMMddHHmmss");
String dd = st.format(dt);
checkAdminRightsFile = new File("C:\\Installer".concat(dd));
RandomAccessFile checkAdminRights = new RandomAccessFile(checkAdminRightsFile, "rw");
checkAdminRights.close();
runWithoutAdminRights=SWT.NO;
}
catch (Exception fs) {
if(fs.getMessage().contains("Access is denied")) {
MessageBox DirMsgBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
runWithoutAdminRights = DirMsgBox.open();
if(runWithoutAdminRights==SWT.NO) {
MessageBox DirMsgBox1 = new MessageBox(shell);
DirMsgBox1.setText("Aborting Installation");
DirMsgBox1.open();
System.exit(0);
}
} else {
MessageBox DirMsgBox1 = new MessageBox(shell);
DirMsgBox1.setMessage("Encountered error while creating file " +
checkAdminRightsFile.getAbsoluteFile() +" : " + fs.getMessage() + "\n Aborting the
process for now");
DirMsgBox1.open();
System.exit(0);
}
}
try {
checkAdminRightsFile.delete();
} catch (Exception ot) {
MessageBox DirMsgBox1 = new MessageBox(shell);
DirMsgBox1.setMessage("Encountered error while deleting the temp file " +
checkAdminRightsFile.getAbsoluteFile() +" : " + ot.getMessage() + "\n Aborting the process
for now");
DirMsgBox1.open();
System.exit(0);
}
}
}
});
b.addMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent arg0) {
}
@Override
public void mouseDown(MouseEvent arg0) {
if(c1.getSelectionIndex()==-1) {
MessageBox DirMsgBox = new MessageBox(shell);
DirMsgBox.setText("Please select Installation Type ");
DirMsgBox.setMessage("Installation type is not selected - please select to proceed ...");
DirMsgBox.open();
} else {
b2.setVisible(true);
workComposite.setVisible(false);
directoryInstComposite.setVisible(true);
}
}
@Override
public void mouseDoubleClick(MouseEvent arg0) {
workComposite.setVisible(false);
directoryInstComposite.setVisible(true);
}
});
directoryInstComposite = new Composite(shell, SWT.NONE);
directoryInstComposite.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
FormData FD_InstPath = new FormData();
FD_InstPath.top=new FormAttachment(0,53);
FD_InstPath.left=new FormAttachment(00,0);
FD_InstPath.width=1364;
FD_InstPath.height=1000;
directoryInstComposite.setLayoutData(FD_InstPath);
directoryInstComposite.setVisible(false);
Canvas canvas3 = new Canvas(directoryInstComposite, SWT.NONE);
canvas3.setSize(500,230);
canvas3.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
canvas3.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY));
e.gc.drawRectangle(3,10,437, 219);
}
});
Canvas canvas4= new Canvas(directoryInstComposite, SWT.NONE);
canvas4.setSize(500,280);
canvas4.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
canvas4.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY));
e.gc.drawRectangle(3,233,437, 31);
}
});
dir_info_label = new Label(canvas3, SWT.NONE);
dir_info_label.setText("Browse for Configuration Directory...");
Font boldFont3 = new Font( dir_info_label.getDisplay(), new FontData( "TimesNewRoman", 10, SWT.BOLD ) );
dir_info_label.setFont(boldFont3);
dir_info_label.setSize(350, 19);
dir_info_label.setLocation(75,25);
dir_entry_label = new Label(canvas3, SWT.NONE);
dir_entry_label.setText("Location:");
dir_entry_label.setSize(60, 20);
dir_entry_label.setLocation(18,65);
dir_entry_text = new Text(canvas3, SWT.BORDER );
dir_entry_text.setText("Enter Directory");
dir_entry_text.setSize(270,19);
dir_entry_text.setLocation(75,65);
dir_browse_button = new Button(canvas3, SWT.PUSH);
dir_browse_button.setText("Browse...");
dir_browse_button.setSize(54,19);
dir_browse_button.setLocation(350,65);
dir_browse_button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DirectoryDialog dlg = new DirectoryDialog(shell);
// Set the initial filter path according
// to anything they've selected or typed in
dlg.setFilterPath(dir_entry_text.getText());
System.out.println("dlg.setFilterPath: "+dir_entry_text.getText());
// Change the title bar text
dlg.setText("SWT's DirectoryDialog");
// Customizable message displayed in the dialog
dlg.setMessage("Select a directory");
// Calling open() will open and run the dialog. It will return the selected directory, or null if user cancels
String dir = dlg.open();
if (dir != null) {
// Set the text box to the new selection
dir_entry_text.setText(dir);
}
}
});
dir_next_button = new Button(canvas4, SWT.NONE);
dir_next_button.setSize(50, 20);
dir_next_button.setLocation(310, 240);
dir_next_button.setText("Install");
dir_cancel_button = new Button(canvas4, SWT.NONE);
dir_cancel_button.setSize(50, 20);
dir_cancel_button.setLocation(365, 240);
dir_cancel_button.setText("Cancel");
dir_next_button.addMouseListener(new MouseListener() {
@Override
public void mouseDown(MouseEvent arg0) {
try {
if(dir_entry_text.getText()!=null && !dir_entry_text.getText().equalsIgnoreCase("")) {
BaseDir = new File(dir_entry_text.getText());
if(!BaseDir.exists() && !BaseDir.isDirectory()) {
MessageBox DirMsgBox = new MessageBox(shell);
DirMsgBox.setText("Directory does not exist!!!! ");
DirMsgBox.open();
} else {
directoryInstComposite.setVisible(false);
copyFilesComposite.setVisible(true);
pbar.setVisible(true);
(new SWT_Second()).new ProgressBarClass(display, pbar).start();
System.out.println("Text in dir_entry_text is : " + dir_entry_text.getText());
String workingDir = System.getProperty("user.dir");
System.out.println("Current directory is : " + workingDir);
currentDir = new File(System.getProperty("user.dir"));
try {
logFile = new File(BaseDir.getAbsolutePath().concat(File.separator).concat(
"Insaller.log"));
if(logFile.exists()) {
Date curr = new Date();
".").concat(curr.toString())));
}
} catch (Exception ex) {
MessageBox DirMsgBox = new MessageBox(shell);
DirMsgBox.setMessage("Exception while creating log file : " + ex.getMessage() +
"\n Aborting the process..");
DirMsgBox.open();
System.exit(0);
// Remove this comment - commented for runnig from eclipse
//copyFiles(currentDir,BaseDir);
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try {
File SetupDir = new File(SWT_Second.currentDir.getAbsolutePath().concat(File
.separator).concat("setup"));
copyFiles(SetupDir,BaseDir);
actualCopyFlag=true;
}
catch (IOException io) {
SWT_Second.actualCopyFlag=false;
SWT_Second.copySuccess=false;
} catch (Exception ex) {
SWT_Second.actualCopyFlag=false;
SWT_Second.copySuccess=false;
ex.printStackTrace();
MessageBox DirMsgBox = new MessageBox(shell);
DirMsgBox.setText("Generic problem!!!! ");
DirMsgBox.setMessage("Some problem occured .. aborting .. check logs
for details! \n" + ex.getMessage() );
DirMsgBox.open();
System.exit(0);
}
}
});
t.start();
}
System.out.println("Copy Progress bar is complete ");
} else {
MessageBox DirMsgBox = new MessageBox(shell);
DirMsgBox.setText("Please select a directory");
DirMsgBox.setMessage("Please select a directory to Install ..");
DirMsgBox.open();
}
} catch (Exception gen) {
gen.printStackTrace();
MessageBox DirMsgBox = new MessageBox(shell);
DirMsgBox.setMessage("Some problem occured .. aborting .. check logs for details! \n" + gen.
getMessage() );
DirMsgBox.open();
}
}
@Override
public void mouseDoubleClick(MouseEvent arg0) {
if(dir_entry_text.getText()!=null && !dir_entry_text.getText().equalsIgnoreCase("")) {
}
}
});
copyFilesComposite = new Composite(shell, SWT.NONE);
copyFilesComposite.setLayoutData(FD_InstPath);
copyFilesComposite.setVisible(false);
Canvas canvas5 = new Canvas(copyFilesComposite, SWT.NONE);
canvas5.setSize(500,230);
canvas5.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
canvas5.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY));
e.gc.drawRectangle(3,10,437, 219);
}
});
Canvas canvas6= new Canvas(copyFilesComposite, SWT.NONE);
canvas6.setSize(500,280);
canvas6.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
canvas6.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY));
e.gc.drawRectangle(3,233,437, 31);
}
pbar = new ProgressBar(canvas5,SWT.NULL);
pbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
pbar.setMinimum(0);
pbar.setMaximum(30);
pbar.setLocation(100,90);
pbar.setSize(280,14);
copy_next_button = new Button(canvas6, SWT.NONE);
copy_next_button.setSize(50, 20);
copy_next_button.setLocation(310, 240);
copy_next_button.setText("Next");
canvas6.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent arg0) {
if(copySuccess) {
if(copyFlag && actualCopyFlag) {
copy_next_button.setEnabled(true);
}
} else {
MessageBox DirMsgBox = new MessageBox(shell);
DirMsgBox.setText("Error in Copy Operation");
DirMsgBox.setMessage("Please check if the directory has write permissions and does not have
Files already present \n please delete the exisitng Files and retry \n Aborting now.."
);
DirMsgBox.open();
System.exit(0);
}
}
});
public static void copyFiles(File srcDir, File destDir) throws IOException{
String strSubDestDir=null;
File subDestDir=null;
for (File f : srcDir.listFiles()) {
if (f.isDirectory()) {
System.out.println("It is a directory");
strSubDestDir = destDir.getAbsolutePath().concat(File.separator).concat(f.getName());
subDestDir = new File(strSubDestDir);
if( !subDestDir.exists() ) {
subDestDir.mkdir();
}
copyFiles(f, subDestDir);
} else {
System.out.println("It is simple a file");
Paths.get(f.getAbsolutePath()).toString() + " to "+
Paths.get(destDir.getAbsolutePath()).toString());
File newFile = new File(destDir.getAbsolutePath().concat(File.separator).concat(f.getName()));
count++;
System.out.println("COUNT : "+count);
if(f.getName().equalsIgnoreCase("Dt.jar") || f.getName().equalsIgnoreCase("ProgressViwer.jar")) {
if(f.getName().equalsIgnoreCase("Dt.jar") && InstallUser.equalsIgnoreCase("Dt Dev User")) {
Files.copy(Paths.get(f.getAbsolutePath()), Paths.get(newFile.getAbsolutePath()),
StandardCopyOption.COPY_ATTRIBUTES);
}
if (f.getName().equalsIgnoreCase("ProgressViwer.jar") && InstallUser.equalsIgnoreCase(
"Operations User")) {
Files.copy(Paths.get(f.getAbsolutePath()), Paths.get(newFile.getAbsolutePath()),
StandardCopyOption.COPY_ATTRIBUTES);
}
} else {
Files.copy(Paths.get(f.getAbsolutePath()), Paths.get(newFile.getAbsolutePath()),
StandardCopyOption.COPY_ATTRIBUTES);
}
}
}
}
class ProgressBarClass extends Thread {
private Display display;
private ProgressBar progressBar;
public ProgressBarClass(Display display, ProgressBar progressBar)
{
this.display = display;
this.progressBar = progressBar;
}
public void run()
{
for (int i = 0; i < 30; i++)
{
try
{
Thread.sleep(500);
}
catch (InterruptedException e)
{
}
display.asyncExec(new Runnable()
{
public void run()
{
if (progressBar.isDisposed())
{
return;
}
System.out.println("progressBar.getSelection() is @@==> " + progressBar.
getSelection());
progressBar.setSelection(progressBar.getSelection() + 1);
System.out.println("Completed");
}
});
}
copyFlag=true;
}
}
}
我的代码显示进度条,但文件没有被复制。
我该如何解决这个问题?
编辑:
我正在尝试使用示例代码。
public static void main (String [] args) throws IOException
{
Display display = new Display ();
Shell shell = new Shell (display);
shell.open ();
File srcFile=new File("C:\\Users\\aa00333221\\Desktop\\s");
File destFile=new File("C:\\Users\\aa00333221\\Desktop\\S2");
String[] files=srcFile.list();
System.out.println("files :"+files);
f1=numberOfFiles(srcFile);
System.out.println("Count: "+f1);
ProgressBar bar = new ProgressBar (shell, SWT.SMOOTH);
bar.setLocation(100,90);
bar.setSize(280,14);
bar.setMaximum(f1);
for (String name : files) {
System.out.println("File name: " + name);
}
for(int i=0;i<f1;i++){
System.out.println("Files[i]: "+files[i]);
strSubDestDir = srcFile.getAbsolutePath().concat(File.separator).concat(files[i]);
subDestDir = new File(strSubDestDir);
File newFile = new File(destFile.getAbsolutePath().concat(File.separator).concat(files[i]));
FileUtils.copyFile(subDestDir, newFile);
bar.setSelection (i+1);
int x=i+1;
System.out.println("bar.setSelection (i+1): "+x );
System.out.println("copy done for "+strSubDestDir +"to "+newFile);
}
while (!shell.isDisposed ())
{
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
public static int numberOfFiles(File srcDir) {
int count = 0;
System.out.println("calling NumbeerOfFiles Method");
File[] listFiles = srcDir.listFiles();
for(int i = 0; i < listFiles.length; i++){
if (listFiles[i].isDirectory()) {
count += numberOfFiles(listFiles[i]);
} else if (listFiles[i].isFile()) {
count++;
}
}
return count;
}
This is working for files only, not for subfolders.
Have to display the progress bar while copying folders and subfolders also.
最佳答案
不太确定您到底在哪里遇到困难,但这里有一些代码逐个文件处理目录并更新 ProgressBar
。您应该能够根据您的需要修改它:
public static void main(String[] args)
{
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("StackOverflow");
shell.setLayout(new FillLayout(SWT.VERTICAL));
Button button = new Button(shell, SWT.PUSH);
button.setText("Start copying");
final ProgressBar bar = new ProgressBar(shell, SWT.NONE);
button.addListener(SWT.Selection, new Listener()
{
@Override
public void handleEvent(Event event)
{
String path = new DirectoryDialog(shell, SWT.OPEN).open();
if (path != null && !"".equals(path))
{
File file = new File(path);
final File[] files = file.listFiles();
if(files == null)
return;
bar.setMinimum(0);
bar.setMaximum(files.length);
bar.setSelection(0);
Runnable run = new Runnable()
{
@Override
public void run()
{
for(File f : files)
{
System.out.println(f);
display.asyncExec(new Runnable()
{
@Override
public void run()
{
bar.setSelection(bar.getSelection() + 1);
}
});
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
display.asyncExec(new Runnable()
{
@Override
public void run()
{
bar.setSelection(0);
}
});
System.out.println("DONE");
}
};
new Thread(run).start();
}
}
});
shell.pack();
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
display.dispose();
}
关于java - 仅在 SWT 而非 jface 中复制文件时显示进度栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30075415/
我正在编写一个应用程序,允许用户创建一个“问卷”,然后向其中添加问题。我正在使用核心数据来存储信息。我创建了一个问卷实体,并与问题实体建立了“一对多”关系。我的问题是,如果要允许用户复制(复制)整个调
有没有办法复制或复制 SharedPreference?或者我需要从一个变量中获取每个变量,然后将它们放入另一个变量中吗? 最佳答案 尝试这样的事情: //sp1 is the shared pref
下面的(A)和(B)有区别吗? (假设 NON ARC,如果重要的话) // --- (A) --- @interface Zoo : NSObject{} @property (copy) Dog
我正在尝试将 mysql SELECT 查询保存到文件中,如下所示: $result = mysqli_query($db,$sql); $out = fopen('tmp/csv.csv', 'w'
我需要创建一个 CVPixelBufferRef 的副本,以便能够使用副本中的值以按位方式操作原始像素缓冲区。我似乎无法使用 CVPixelBufferCreate 或 CVPixelBufferCr
我在 Source 文件夹中有一个 Active wave 录音 wave-file.wav。我需要使用新名称 wave-file-copy.wav 将此文件复制到 Destination 文件夹。
在使用 GNU Autotools 构建的项目中,我有一个脚本需要通过 make 修改以包含安装路径。这是一个小例子: configure.ac: AC_INIT(foobar, 1.0) AC_PR
我想将 SQL 的行复制到同一个表中。但是在我的表中,我有一个“文本”列。 使用此 SQL: CREATE TEMPORARY TABLE produit2 ENGINE=MEMORY SELECT
谁能给我解释一下 df2 = df1 df2 = df1.copy() df3 = df1.copy(deep=False) 我已经尝试了所有选项并执行了以下操作: df1 = pd.DataFram
Hazelcast 是否具有类似于 Ehcache 的复制? http://www.ehcache.org/generated/2.9.0/pdf/Ehcache_Replication_Guide.
我有以下拓扑。一个 Ubuntu 16.04。运行我的全局 MySQL 服务器的 Amazon AWS 上的实例。我想将此服务器用作许多本地主服务器(Windows 机器 MySQL 服务器)的从服务
使用 SQLyog,我正在测试表中是否设置了正确的值。我尝试过 SELECT type_service FROM service WHERE email='test@gmail.com' 因此,只输出
有人可以提供一些关于如何配置 ElasticSearch 进行复制的说明。我在 Windows 中运行 ES,并且了解如果我在同一台服务器上多次运行 bat 文件,则会启动一个单独的 ES 实例,并且
一 点睛 ThreadGroup 复制线程的两个方法。 public int enumerate(Thread list[]) // 会将 ThreadGroup 中的 active 线程全部复制到
一 点睛 ThreadGroup 复制线程组的两个方法。 public int enumerate(ThreadGroup list[]) // 相对于 enumerate(list,true) pu
官方documentation Cassandra 说: Configure the keyspace and create the new datacenter: Use ALTER KEYSPAC
This question already has answers here: How to weight smoothing by arbitrary factor in ggplot2? (2个答
我们有一个表格来表明对各种俱乐部的兴趣。输出将数据记录在 Excel 电子表格中,其中列有他们的首选姓名、姓氏、电子邮件、代词,以及他们感兴趣的俱乐部的相应列中的“1”(下面的模型)。 我们希望为俱乐
This question already has answers here: Closed 8 years ago. Possible Duplicate: In vim, how do I get
如何复制形状及其所在的单元格?当我手动复制时,形状会跟随单元格,但是当我使用宏进行复制时,我会得到除形状之外的所有其他内容。 Cells(sourceRow, sourceColumn).Copy C
我是一名优秀的程序员,十分优秀!