dialogs to frame
This commit is contained in:
parent
b484bf365f
commit
b07e888bae
@ -3799,10 +3799,7 @@ public class MainWindow extends JFrame {
|
|||||||
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
progressDialog.dispose();
|
progressDialog.dispose();
|
||||||
|
|
||||||
// Force the window to front and request focus after modal dialog
|
|
||||||
MainWindow.this.toFront();
|
|
||||||
|
|
||||||
for (FilePanel panel : panelsToRefresh) {
|
for (FilePanel panel : panelsToRefresh) {
|
||||||
panel.refresh(false);
|
panel.refresh(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import java.awt.event.ActionListener;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OperationQueueDialog extends JDialog {
|
public class OperationQueueDialog extends JFrame {
|
||||||
private final JTable table;
|
private final JTable table;
|
||||||
private final TaskTableModel model;
|
private final TaskTableModel model;
|
||||||
private static OperationQueueDialog instance;
|
private static OperationQueueDialog instance;
|
||||||
@ -23,16 +23,24 @@ public class OperationQueueDialog extends JDialog {
|
|||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new OperationQueueDialog(owner);
|
instance = new OperationQueueDialog(owner);
|
||||||
}
|
}
|
||||||
|
if ((instance.getExtendedState() & Frame.ICONIFIED) != 0) {
|
||||||
|
instance.setExtendedState(instance.getExtendedState() & ~Frame.ICONIFIED);
|
||||||
|
}
|
||||||
instance.setVisible(true);
|
instance.setVisible(true);
|
||||||
instance.toFront();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private OperationQueueDialog(Frame owner) {
|
private OperationQueueDialog(Frame owner) {
|
||||||
super(owner, "File Operation Queue", false);
|
super("File Operation Queue");
|
||||||
|
|
||||||
setLayout(new BorderLayout(10, 10));
|
setLayout(new BorderLayout(10, 10));
|
||||||
setSize(600, 400);
|
setSize(600, 400);
|
||||||
|
setResizable(false);
|
||||||
|
setAutoRequestFocus(false);
|
||||||
|
setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
|
||||||
setLocationRelativeTo(owner);
|
setLocationRelativeTo(owner);
|
||||||
|
if (owner != null) {
|
||||||
|
setIconImage(owner.getIconImage());
|
||||||
|
}
|
||||||
|
|
||||||
model = new TaskTableModel();
|
model = new TaskTableModel();
|
||||||
table = new JTable(model);
|
table = new JTable(model);
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import java.awt.event.WindowAdapter;
|
|||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class ProgressDialog extends JDialog {
|
public class ProgressDialog extends JFrame {
|
||||||
private final JProgressBar progressBar;
|
private final JProgressBar progressBar;
|
||||||
private final JProgressBar fileProgressBar;
|
private final JProgressBar fileProgressBar;
|
||||||
private final JLabel statusLabel;
|
private final JLabel statusLabel;
|
||||||
@ -30,10 +30,18 @@ public class ProgressDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ProgressDialog(Frame owner, String title, boolean modal) {
|
public ProgressDialog(Frame owner, String title, boolean modal) {
|
||||||
super(owner, title, modal);
|
super(title);
|
||||||
|
|
||||||
setLayout(new BorderLayout(10, 10));
|
setLayout(new BorderLayout(10, 10));
|
||||||
((JPanel)getContentPane()).setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
|
((JPanel)getContentPane()).setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
|
||||||
|
setResizable(false);
|
||||||
|
setAutoRequestFocus(false);
|
||||||
|
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||||
|
if (owner != null) {
|
||||||
|
setLocationByPlatform(true);
|
||||||
|
setLocationRelativeTo(owner);
|
||||||
|
setIconImage(owner.getIconImage());
|
||||||
|
}
|
||||||
|
|
||||||
JPanel infoPanel = new JPanel(new GridLayout(2, 1, 5, 5));
|
JPanel infoPanel = new JPanel(new GridLayout(2, 1, 5, 5));
|
||||||
statusLabel = new JLabel("Starting...");
|
statusLabel = new JLabel("Starting...");
|
||||||
@ -57,7 +65,7 @@ public class ProgressDialog extends JDialog {
|
|||||||
|
|
||||||
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||||
pauseButton = new JButton("Pause");
|
pauseButton = new JButton("Pause");
|
||||||
backgroundButton = new JButton("Background");
|
backgroundButton = new JButton("Minimize");
|
||||||
cancelButton = new JButton("Cancel");
|
cancelButton = new JButton("Cancel");
|
||||||
|
|
||||||
pauseButton.addActionListener(e -> {
|
pauseButton.addActionListener(e -> {
|
||||||
@ -70,13 +78,7 @@ public class ProgressDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
backgroundButton.addActionListener(e -> {
|
backgroundButton.addActionListener(e -> setState(Frame.ICONIFIED));
|
||||||
boolean wasModal = isModal();
|
|
||||||
setVisible(false);
|
|
||||||
setModal(!wasModal);
|
|
||||||
backgroundButton.setText(wasModal ? "Foreground" : "Background");
|
|
||||||
setVisible(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
cancelButton.addActionListener(e -> {
|
cancelButton.addActionListener(e -> {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
@ -93,7 +95,6 @@ public class ProgressDialog extends JDialog {
|
|||||||
buttonPanel.add(cancelButton);
|
buttonPanel.add(cancelButton);
|
||||||
add(buttonPanel, BorderLayout.SOUTH);
|
add(buttonPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
|
||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent e) {
|
public void windowClosing(WindowEvent e) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user