form scroll opt

This commit is contained in:
RememBerBer 2021-11-24 11:22:41 +08:00
parent 0a091c6c3e
commit 5d1f9b4a1c
6 changed files with 20 additions and 15 deletions

View File

@ -8,6 +8,7 @@ import com.intellij.uiDesigner.core.Spacer;
import com.luoboduner.moo.info.App;
import com.luoboduner.moo.info.ui.UiConsts;
import com.luoboduner.moo.info.util.ComponentUtil;
import com.luoboduner.moo.info.util.ScrollUtil;
import com.luoboduner.moo.info.util.UpgradeUtil;
import javax.swing.*;
@ -60,8 +61,7 @@ public class AboutDialog extends JDialog {
logoLabel.setIcon(new FlatSVGIcon("icons/logo-128.svg"));
versionLabel.setText(UiConsts.APP_VERSION);
scrollPane.getVerticalScrollBar().setUnitIncrement(16);
scrollPane.getVerticalScrollBar().setDoubleBuffered(true);
ScrollUtil.smoothPane(scrollPane);
contentPane.updateUI();
logoLabel.addMouseListener(new MouseAdapter() {

View File

@ -7,6 +7,7 @@ import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.luoboduner.moo.info.App;
import com.luoboduner.moo.info.util.ComponentUtil;
import com.luoboduner.moo.info.util.ScrollUtil;
import javax.swing.*;
import javax.swing.border.TitledBorder;
@ -46,8 +47,7 @@ public class SettingDialog extends JDialog {
contentPane.registerKeyboardAction(e -> onOK(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
// Set the scroll bar speed
settingScrollPane.getVerticalScrollBar().setUnitIncrement(16);
settingScrollPane.getVerticalScrollBar().setDoubleBuffered(true);
ScrollUtil.smoothPane(settingScrollPane);
// routine
autoCheckUpdateCheckBox.setSelected(App.config.isAutoCheckUpdate());

View File

@ -16,7 +16,7 @@
<properties/>
<border type="none"/>
<children>
<scrollpane id="d4e6a">
<scrollpane id="d4e6a" binding="scrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>

View File

@ -7,6 +7,7 @@ import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.luoboduner.moo.info.App;
import com.luoboduner.moo.info.util.ScrollUtil;
import lombok.Getter;
import oshi.PlatformEnum;
import oshi.SystemInfo;
@ -31,6 +32,7 @@ import java.util.concurrent.TimeUnit;
public class DiskForm {
private JPanel mainPanel;
private JPanel diskListPanel;
private JScrollPane scrollPane;
private static final Log logger = LogFactory.get();
@ -53,6 +55,7 @@ public class DiskForm {
}
private static void initUi() {
ScrollUtil.smoothPane(getInstance().getScrollPane());
}
private static void initInfo() {
@ -129,12 +132,12 @@ public class DiskForm {
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
mainPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JScrollPane scrollPane1 = new JScrollPane();
panel1.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
scrollPane = new JScrollPane();
panel1.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
diskListPanel = new JPanel();
diskListPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 10, 0, 10), -1, -1));
scrollPane1.setViewportView(diskListPanel);
scrollPane.setViewportView(diskListPanel);
}
/**

View File

@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<scrollpane id="6ac81">
<scrollpane id="6ac81" binding="scrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>

View File

@ -8,6 +8,7 @@ import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.luoboduner.moo.info.App;
import com.luoboduner.moo.info.ui.Style;
import com.luoboduner.moo.info.util.ScrollUtil;
import lombok.Getter;
import oshi.hardware.PowerSource;
@ -31,6 +32,7 @@ public class PowerSourceForm {
private JPanel powerBasePanel;
private JPanel powerInfoPanel;
private JTextPane powerInfoTextPane;
private JScrollPane scrollPane;
private static final Log logger = LogFactory.get();
@ -52,7 +54,7 @@ public class PowerSourceForm {
}
private static void initUi() {
ScrollUtil.smoothPane(getInstance().getScrollPane());
}
private static void initInfo() {
@ -174,12 +176,12 @@ public class PowerSourceForm {
private void $$$setupUI$$$() {
mainPanel = new JPanel();
mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
final JScrollPane scrollPane1 = new JScrollPane();
mainPanel.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
scrollPane = new JScrollPane();
mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1));
scrollPane1.setViewportView(panel1);
scrollPane.setViewportView(panel1);
final Spacer spacer1 = new Spacer();
panel1.add(spacer1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
powerBasePanel = new JPanel();