-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from rememberber/develop
Develop
- Loading branch information
Showing
12 changed files
with
411 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/luoboduner/moo/tool/ui/dialog/TranslationDialog.form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.tool.ui.dialog.TranslationDialog"> | ||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<xy x="48" y="54" width="436" height="297"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<grid id="e3588" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children/> | ||
</grid> | ||
</children> | ||
</grid> | ||
</form> |
100 changes: 100 additions & 0 deletions
100
src/main/java/com/luoboduner/moo/tool/ui/dialog/TranslationDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package com.luoboduner.moo.tool.ui.dialog; | ||
|
||
import com.formdev.flatlaf.util.SystemInfo; | ||
import com.intellij.uiDesigner.core.GridConstraints; | ||
import com.intellij.uiDesigner.core.GridLayoutManager; | ||
import com.luoboduner.moo.tool.ui.form.TranslationLayoutForm; | ||
import com.luoboduner.moo.tool.util.ComponentUtil; | ||
import com.luoboduner.moo.tool.util.SystemUtil; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
|
||
public class TranslationDialog extends JFrame { | ||
private JPanel contentPane; | ||
private JPanel mainPanel; | ||
private TranslationLayoutForm translationLayoutForm; | ||
|
||
public TranslationDialog() { | ||
// super(App.mainFrame, "翻译"); | ||
ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.4, 0.64); | ||
setContentPane(contentPane); | ||
|
||
if (SystemUtil.isMacOs() && SystemInfo.isMacFullWindowContentSupported) { | ||
this.getRootPane().putClientProperty("apple.awt.fullWindowContent", true); | ||
this.getRootPane().putClientProperty("apple.awt.transparentTitleBar", true); | ||
this.getRootPane().putClientProperty("apple.awt.fullscreenable", true); | ||
this.getRootPane().putClientProperty("apple.awt.windowTitleVisible", false); | ||
GridLayoutManager gridLayoutManager = (GridLayoutManager) contentPane.getLayout(); | ||
gridLayoutManager.setMargin(new Insets(28, 0, 0, 0)); | ||
} | ||
|
||
// 半透明 | ||
// setUndecorated(true); | ||
// setOpacity(0.95f); | ||
|
||
mainPanel.setLayout(new BorderLayout()); | ||
// 设置四边距:10 | ||
mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); | ||
translationLayoutForm = new TranslationLayoutForm(); | ||
mainPanel.add(translationLayoutForm.getMainLayoutPanel()); | ||
|
||
translationLayoutForm.getSplitPane().setDividerLocation((this.getWidth() - 20) / 2); | ||
|
||
// call onCancel() when cross is clicked | ||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); | ||
addWindowListener(new WindowAdapter() { | ||
public void windowClosing(WindowEvent e) { | ||
onCancel(); | ||
} | ||
}); | ||
|
||
// call onCancel() on ESCAPE | ||
contentPane.registerKeyboardAction(new ActionListener() { | ||
public void actionPerformed(ActionEvent e) { | ||
onCancel(); | ||
} | ||
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); | ||
} | ||
|
||
private void onOK() { | ||
// add your code here | ||
dispose(); | ||
} | ||
|
||
private void onCancel() { | ||
// add your code here if necessary | ||
dispose(); | ||
} | ||
|
||
{ | ||
// GUI initializer generated by IntelliJ IDEA GUI Designer | ||
// >>> IMPORTANT!! <<< | ||
// DO NOT EDIT OR ADD ANY CODE HERE! | ||
$$$setupUI$$$(); | ||
} | ||
|
||
/** | ||
* Method generated by IntelliJ IDEA GUI Designer | ||
* >>> IMPORTANT!! <<< | ||
* DO NOT edit this method OR call it in your code! | ||
* | ||
* @noinspection ALL | ||
*/ | ||
private void $$$setupUI$$$() { | ||
contentPane = new JPanel(); | ||
contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); | ||
mainPanel = new JPanel(); | ||
mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); | ||
contentPane.add(mainPanel, 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)); | ||
} | ||
|
||
/** | ||
* @noinspection ALL | ||
*/ | ||
public JComponent $$$getRootComponent$$$() { | ||
return contentPane; | ||
} | ||
|
||
} |
119 changes: 119 additions & 0 deletions
119
src/main/java/com/luoboduner/moo/tool/ui/form/TranslationLayoutForm.form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.tool.ui.form.TranslationLayoutForm"> | ||
<grid id="27dc6" binding="mainLayoutPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<xy x="20" y="20" width="500" height="400"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<grid id="b4cf3" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<component id="2ea0c" class="javax.swing.JComboBox" binding="comboBox1" default-binding="true"> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<model> | ||
<item value="自动检测"/> | ||
<item value="中文(简体)"/> | ||
<item value="英语"/> | ||
</model> | ||
</properties> | ||
</component> | ||
<hspacer id="6053b"> | ||
<constraints> | ||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
</hspacer> | ||
<component id="5e074" class="javax.swing.JButton" binding="exchangeButton"> | ||
<constraints> | ||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text value=""/> | ||
</properties> | ||
</component> | ||
<component id="2a689" class="javax.swing.JComboBox" binding="comboBox2" default-binding="true"> | ||
<constraints> | ||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<model> | ||
<item value="中文(简体)"/> | ||
<item value="英语"/> | ||
</model> | ||
</properties> | ||
</component> | ||
</children> | ||
</grid> | ||
<splitpane id="dfc38" binding="splitPane"> | ||
<constraints> | ||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"> | ||
<preferred-size width="200" height="200"/> | ||
</grid> | ||
</constraints> | ||
<properties> | ||
<continuousLayout value="true"/> | ||
<dividerLocation value="224"/> | ||
</properties> | ||
<border type="none"/> | ||
<children> | ||
<grid id="46f68" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<splitpane position="left"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<scrollpane id="4cd66"> | ||
<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> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<component id="3dad6" class="javax.swing.JTextArea" binding="textArea1" default-binding="true"> | ||
<constraints/> | ||
<properties/> | ||
</component> | ||
</children> | ||
</scrollpane> | ||
</children> | ||
</grid> | ||
<grid id="e3173" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<splitpane position="right"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<scrollpane id="b3e56"> | ||
<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> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<component id="82e1a" class="javax.swing.JTextArea" binding="textArea2" default-binding="true"> | ||
<constraints/> | ||
<properties/> | ||
</component> | ||
</children> | ||
</scrollpane> | ||
</children> | ||
</grid> | ||
</children> | ||
</splitpane> | ||
</children> | ||
</grid> | ||
</form> |
92 changes: 92 additions & 0 deletions
92
src/main/java/com/luoboduner/moo/tool/ui/form/TranslationLayoutForm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package com.luoboduner.moo.tool.ui.form; | ||
|
||
import com.formdev.flatlaf.extras.FlatSVGIcon; | ||
import com.intellij.uiDesigner.core.GridConstraints; | ||
import com.intellij.uiDesigner.core.GridLayoutManager; | ||
import com.intellij.uiDesigner.core.Spacer; | ||
import lombok.Getter; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
@Getter | ||
public class TranslationLayoutForm { | ||
private JComboBox comboBox1; | ||
private JButton exchangeButton; | ||
private JComboBox comboBox2; | ||
private JTextArea textArea1; | ||
private JTextArea textArea2; | ||
private JPanel mainLayoutPanel; | ||
private JSplitPane splitPane; | ||
|
||
public TranslationLayoutForm() { | ||
exchangeButton.setIcon(new FlatSVGIcon("icon/exchange.svg")); | ||
textArea1.setText("施工中,敬请期待..."); | ||
} | ||
|
||
{ | ||
// GUI initializer generated by IntelliJ IDEA GUI Designer | ||
// >>> IMPORTANT!! <<< | ||
// DO NOT EDIT OR ADD ANY CODE HERE! | ||
$$$setupUI$$$(); | ||
} | ||
|
||
/** | ||
* Method generated by IntelliJ IDEA GUI Designer | ||
* >>> IMPORTANT!! <<< | ||
* DO NOT edit this method OR call it in your code! | ||
* | ||
* @noinspection ALL | ||
*/ | ||
private void $$$setupUI$$$() { | ||
mainLayoutPanel = new JPanel(); | ||
mainLayoutPanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); | ||
final JPanel panel1 = new JPanel(); | ||
panel1.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1)); | ||
mainLayoutPanel.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)); | ||
comboBox1 = new JComboBox(); | ||
final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); | ||
defaultComboBoxModel1.addElement("自动检测"); | ||
defaultComboBoxModel1.addElement("中文(简体)"); | ||
defaultComboBoxModel1.addElement("英语"); | ||
comboBox1.setModel(defaultComboBoxModel1); | ||
panel1.add(comboBox1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); | ||
final Spacer spacer1 = new Spacer(); | ||
panel1.add(spacer1, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); | ||
exchangeButton = new JButton(); | ||
exchangeButton.setText(""); | ||
panel1.add(exchangeButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); | ||
comboBox2 = new JComboBox(); | ||
final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel(); | ||
defaultComboBoxModel2.addElement("中文(简体)"); | ||
defaultComboBoxModel2.addElement("英语"); | ||
comboBox2.setModel(defaultComboBoxModel2); | ||
panel1.add(comboBox2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); | ||
splitPane = new JSplitPane(); | ||
splitPane.setContinuousLayout(true); | ||
splitPane.setDividerLocation(224); | ||
mainLayoutPanel.add(splitPane, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(200, 200), null, 0, false)); | ||
final JPanel panel2 = new JPanel(); | ||
panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); | ||
splitPane.setLeftComponent(panel2); | ||
final JScrollPane scrollPane1 = new JScrollPane(); | ||
panel2.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)); | ||
textArea1 = new JTextArea(); | ||
scrollPane1.setViewportView(textArea1); | ||
final JPanel panel3 = new JPanel(); | ||
panel3.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); | ||
splitPane.setRightComponent(panel3); | ||
final JScrollPane scrollPane2 = new JScrollPane(); | ||
panel3.add(scrollPane2, 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)); | ||
textArea2 = new JTextArea(); | ||
scrollPane2.setViewportView(textArea2); | ||
} | ||
|
||
/** | ||
* @noinspection ALL | ||
*/ | ||
public JComponent $$$getRootComponent$$$() { | ||
return mainLayoutPanel; | ||
} | ||
|
||
} |
Oops, something went wrong.