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