mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-25 21:29:15 +00:00
windows changes
This commit is contained in:
parent
462744dce1
commit
aa7b57dca8
src/com/bytezone/diskbrowser/gui
@ -122,8 +122,6 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||
menuHandler.duplicateItem.setAction (duplicateAction);
|
||||
menuHandler.closeTabItem.setAction (closeTabAction);
|
||||
|
||||
// final QuitAction quitAction = Platform.setQuit (this, prefs, menuHandler.fileMenu);
|
||||
|
||||
addQuitListener (menuHandler);
|
||||
addQuitListener (catalogPanel);
|
||||
addQuitListener (this);
|
||||
@ -131,18 +129,12 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||
if (Desktop.isDesktopSupported ())
|
||||
{
|
||||
Desktop desktop = Desktop.getDesktop ();
|
||||
if (false)
|
||||
{
|
||||
System.out.println ("Enums:");
|
||||
for (Desktop.Action a : Desktop.Action.values ())
|
||||
System.out.printf ("%s is%s supported%n", a.toString (),
|
||||
(desktop.isSupported (a) ? "" : " not"));
|
||||
}
|
||||
|
||||
if (desktop.isSupported (Desktop.Action.APP_ABOUT))
|
||||
desktop.setAboutHandler (e -> JOptionPane.showMessageDialog (null,
|
||||
"Author - Denis Molony\nGitHub - https://github.com/dmolony/DiskBrowser",
|
||||
"About DiskBrowser", JOptionPane.INFORMATION_MESSAGE));
|
||||
|
||||
if (desktop.isSupported (Desktop.Action.APP_QUIT_HANDLER))
|
||||
desktop.setQuitHandler ( (e, r) -> fireQuitEvent ());
|
||||
else
|
||||
@ -182,7 +174,6 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||
{
|
||||
JPanel panel = new JPanel (new BorderLayout ());
|
||||
panel.setBackground (Color.WHITE);
|
||||
// panel.setOpaque (true);
|
||||
panel.setBorder (BorderFactory.createTitledBorder (title));
|
||||
panel.add (pane);
|
||||
add (panel, location);
|
||||
@ -199,7 +190,6 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||
@Override
|
||||
public void quit (Preferences preferences)
|
||||
{
|
||||
// windowSaver = new WindowSaver (prefs, this, "DiskBrowser");
|
||||
windowSaver.saveWindow ();
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,9 @@ class DiskLayoutImage extends DiskPanel implements Scrollable, RedoListener
|
||||
setPreferredSize (new Dimension (240 + 1, 525 + 1));
|
||||
addMouseListener (new MyMouseListener ());
|
||||
setBackground (backgroundColor);
|
||||
setOpaque (true);
|
||||
|
||||
// setOpaque (true);
|
||||
// https://stackoverflow.com/questions/2451990/setopaquetrue-false-java
|
||||
|
||||
addKeyListener (new MyKeyListener ());
|
||||
}
|
||||
@ -131,9 +133,8 @@ class DiskLayoutImage extends DiskPanel implements Scrollable, RedoListener
|
||||
private void drawBlock (Graphics2D g, SectorType type, int x, int y, boolean flagFree,
|
||||
boolean selected)
|
||||
{
|
||||
// draw block
|
||||
g.setColor (type.colour);
|
||||
g.fillRect (x + offset, y + offset, width, height);
|
||||
g.fillRect (x + 1, y + 1, blockWidth - 1, blockHeight - 1);
|
||||
|
||||
if (flagFree || selected)
|
||||
{
|
||||
|
@ -47,12 +47,10 @@ class DiskLayoutPanel extends JPanel
|
||||
legendPanel = new DiskLegendPanel ();
|
||||
|
||||
setBackground (Color.WHITE);
|
||||
setOpaque (true);
|
||||
|
||||
sp = new JScrollPane (diskLayoutImage, VERTICAL_SCROLLBAR_ALWAYS,
|
||||
HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||
sp.setBackground (Color.WHITE);
|
||||
sp.setOpaque (true);
|
||||
sp.setColumnHeaderView (horizontalRuler);
|
||||
sp.setRowHeaderView (verticalRuler);
|
||||
sp.setBorder (null);
|
||||
|
@ -64,7 +64,7 @@ class DiskLegendPanel extends DiskPanel
|
||||
|
||||
// draw block
|
||||
g.setColor (type.colour);
|
||||
g.fillRect (x + offset, y + offset, width, height);
|
||||
g.fillRect (x + 1, y + 1, blockWidth - 1, blockHeight - 1);
|
||||
|
||||
// draw text
|
||||
g.setColor (Color.BLACK);
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.bytezone.diskbrowser.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
@ -13,12 +11,10 @@ public class DiskPanel extends JPanel
|
||||
{
|
||||
FormattedDisk formattedDisk;
|
||||
LayoutDetails layoutDetails;
|
||||
boolean isRetina;
|
||||
// boolean isRetina;
|
||||
int blockWidth = 30; // default
|
||||
int blockHeight = 15; // default
|
||||
int width;
|
||||
int height;
|
||||
int offset;
|
||||
// int offset;
|
||||
int centerOffset;
|
||||
|
||||
Color backgroundColor = new Color (0xE0, 0xE0, 0xE0);
|
||||
@ -30,15 +26,14 @@ public class DiskPanel extends JPanel
|
||||
|
||||
blockWidth = layoutDetails.block.width;
|
||||
blockHeight = layoutDetails.block.height;
|
||||
|
||||
Graphics2D g = (Graphics2D) this.getGraphics ();
|
||||
if (g != null) // panel might not be showing
|
||||
isRetina = g.getFontRenderContext ().getTransform ()
|
||||
.equals (AffineTransform.getScaleInstance (2.0, 2.0));
|
||||
|
||||
width = blockWidth - (isRetina ? 2 : 3) + 1;
|
||||
height = blockHeight - (isRetina ? 2 : 3) + 1;
|
||||
offset = isRetina ? 1 : 2;
|
||||
centerOffset = (blockWidth - 4) / 2 + 1;
|
||||
|
||||
// Graphics2D g = (Graphics2D) this.getGraphics ();
|
||||
// if (g != null) // panel might not be showing
|
||||
// isRetina = g.getFontRenderContext ().getTransform ()
|
||||
// .equals (AffineTransform.getScaleInstance (2.0, 2.0));
|
||||
|
||||
// offset = isRetina ? 1 : 2;
|
||||
// centerOffset = (blockWidth - 4) / 2 + 1;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class ScrollRuler extends JComponent
|
||||
|
||||
// set defaults until setLayout is called
|
||||
if (orientation == HORIZONTAL)
|
||||
setPreferredSize (new Dimension (0, HEIGHT)); // width/height
|
||||
setPreferredSize (new Dimension (0, HEIGHT)); // width/height
|
||||
else
|
||||
setPreferredSize (new Dimension (WIDTH, 0));
|
||||
}
|
||||
@ -96,7 +96,7 @@ class ScrollRuler extends JComponent
|
||||
String format;
|
||||
int offset;
|
||||
|
||||
if (layoutDetails.block.width <= 15)
|
||||
if (layoutDetails.block.width <= 16)
|
||||
{
|
||||
format = isHex ? "%1X" : "%1d";
|
||||
offset = isHex ? 4 : 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user