mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Shorten donation label when window is smaller
This commit is contained in:
@@ -3170,6 +3170,10 @@
|
|||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Improved rendering precision, especially when using metric units</description>
|
<description>Improved rendering precision, especially when using metric units</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Shorten donation label when the window is smaller</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>On MacOS the app registers to open .DIY files</description>
|
<description>On MacOS the app registers to open .DIY files</description>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<property name="jar.dir" value="${build.dir}/jar" />
|
<property name="jar.dir" value="${build.dir}/jar" />
|
||||||
<property name="report.dir" value="${build.dir}/junitreport" />
|
<property name="report.dir" value="${build.dir}/junitreport" />
|
||||||
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
||||||
<property name="diylc.version" value="4.8.0" />
|
<property name="diylc.version" value="4.9.0" />
|
||||||
|
|
||||||
<property name="classes.dir" value="${build.dir}/temp/${ant.project.name}/classes" />
|
<property name="classes.dir" value="${build.dir}/temp/${ant.project.name}/classes" />
|
||||||
<property name="test.classes.dir" value="${build.dir}/temp/${ant.project.name}/test.classes" />
|
<property name="test.classes.dir" value="${build.dir}/temp/${ant.project.name}/test.classes" />
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import java.awt.Cursor;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
|
import java.awt.event.ComponentAdapter;
|
||||||
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
@@ -29,6 +31,8 @@ import java.util.EnumSet;
|
|||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JRootPane;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.Utils;
|
import org.diylc.appframework.miscutils.Utils;
|
||||||
import org.diylc.common.EventType;
|
import org.diylc.common.EventType;
|
||||||
@@ -57,6 +61,7 @@ public class ActionBarPlugin implements IPlugIn {
|
|||||||
private JLabel donateLabel;
|
private JLabel donateLabel;
|
||||||
|
|
||||||
private static final String DONATE_HTML = "<html><u>" + LangUtil.translate("Enjoying DIYLC? Click here to buy me a coffee :)") + "</u></html>";
|
private static final String DONATE_HTML = "<html><u>" + LangUtil.translate("Enjoying DIYLC? Click here to buy me a coffee :)") + "</u></html>";
|
||||||
|
private static final String DONATE_HTML_SHORT = "<html><u>" + LangUtil.translate("Donate") + "</u></html>";
|
||||||
|
|
||||||
public ActionBarPlugin(ISwingUI swingUI) {
|
public ActionBarPlugin(ISwingUI swingUI) {
|
||||||
this.swingUI = swingUI;
|
this.swingUI = swingUI;
|
||||||
@@ -105,6 +110,25 @@ public class ActionBarPlugin implements IPlugIn {
|
|||||||
donateLabel.setForeground(Color.blue);
|
donateLabel.setForeground(Color.blue);
|
||||||
donateLabel.setIcon(IconLoader.Donate.getIcon());
|
donateLabel.setIcon(IconLoader.Donate.getIcon());
|
||||||
donateLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
donateLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
|
this.swingUI.getOwnerFrame().addComponentListener(new ComponentAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentShown(ComponentEvent e) {
|
||||||
|
JRootPane rootPane = SwingUtilities.getRootPane(donateLabel);
|
||||||
|
rootPane.addComponentListener(new ComponentAdapter() {
|
||||||
|
@Override
|
||||||
|
public void componentResized(ComponentEvent e) {
|
||||||
|
if (rootPane.getWidth() < 920) {
|
||||||
|
if (!DONATE_HTML_SHORT.equals(donateLabel.getText()))
|
||||||
|
donateLabel.setText(DONATE_HTML_SHORT);
|
||||||
|
} else {
|
||||||
|
if (!DONATE_HTML.equals(donateLabel.getText()))
|
||||||
|
donateLabel.setText(DONATE_HTML);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
donateLabel.addMouseListener(new MouseAdapter() {
|
donateLabel.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user