pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1862653 - in /pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger: PDFDebugger.java ui/WindowPrefs.java
Date Sat, 06 Jul 2019 10:56:19 GMT
Author: tilman
Date: Sat Jul  6 10:56:19 2019
New Revision: 1862653

URL: http://svn.apache.org/viewvc?rev=1862653&view=rev
Log:
PDFBOX-2941: save and restore window settings

Added:
    pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/WindowPrefs.java
      - copied unchanged from r1862652, pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/WindowPrefs.java
Modified:
    pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java

Modified: pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java?rev=1862653&r1=1862652&r2=1862653&view=diff
==============================================================================
--- pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
(original)
+++ pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
Sat Jul  6 10:56:19 2019
@@ -21,6 +21,7 @@ import java.awt.Component;
 import java.awt.Cursor;
 import java.awt.Dimension;
 import java.awt.FileDialog;
+import java.awt.Frame;
 import java.awt.Toolkit;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
@@ -108,6 +109,7 @@ import org.apache.pdfbox.debugger.ui.Rec
 import org.apache.pdfbox.debugger.ui.RotationMenu;
 import org.apache.pdfbox.debugger.ui.Tree;
 import org.apache.pdfbox.debugger.ui.ViewMenu;
+import org.apache.pdfbox.debugger.ui.WindowPrefs;
 import org.apache.pdfbox.debugger.ui.ZoomMenu;
 import org.apache.pdfbox.filter.FilterFactory;
 import org.apache.pdfbox.io.IOUtils;
@@ -149,6 +151,7 @@ public class PDFDebugger extends JFrame
     private final JPanel documentPanel = new JPanel();
     private TreeStatusPane statusPane;
     private RecentFiles recentFiles;
+    private WindowPrefs windowPrefs;
     private boolean isPageMode;
     private PDDocument document;
     private String currentFilePath;
@@ -359,10 +362,10 @@ public class PDFDebugger extends JFrame
             }
         });
 
-        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        windowPrefs = new WindowPrefs(this.getClass());
+
         jScrollPane1.setBorder(new BevelBorder(BevelBorder.RAISED));
-        jScrollPane1.setPreferredSize(new Dimension(screenSize.width / 8, 500));
-        jSplitPane1.setDividerLocation(screenSize.width / 8);
+        jSplitPane1.setDividerLocation(windowPrefs.getDividerLocation());
         tree.addTreeSelectionListener(new TreeSelectionListener()
         {
             @Override
@@ -377,7 +380,6 @@ public class PDFDebugger extends JFrame
         jSplitPane1.setRightComponent(jScrollPane2);
         jSplitPane1.setDividerSize(3);
 
-        jScrollPane2.setPreferredSize(new Dimension(screenSize.width / 8 * 7, 500));
         jScrollPane2.setViewportView(jTextPane1);
 
         jSplitPane1.setLeftComponent(jScrollPane1);
@@ -404,7 +406,8 @@ public class PDFDebugger extends JFrame
         menuBar.add(viewMenu.getMenu());
         setJMenuBar(menuBar);
 
-        setBounds(screenSize.width / 4, screenSize.height / 4, screenSize.width / 2, screenSize.height
/ 2);
+        setExtendedState(windowPrefs.getExtendedState());
+        setBounds(windowPrefs.getBounds());
 
         // drag and drop to open files
         setTransferHandler(new TransferHandler()
@@ -1190,6 +1193,10 @@ public class PDFDebugger extends JFrame
                 throw new RuntimeException(e);
             }
         }
+        windowPrefs.setExtendedState(getExtendedState());
+        this.setExtendedState(Frame.NORMAL);
+        windowPrefs.setBounds(getBounds());
+        windowPrefs.setDividerLocation(jSplitPane1.getDividerLocation());
         performApplicationExit();
     }
 



Mime
View raw message