mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
translate loadline editor
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.diylc.swing.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
public class TranslatedPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
if (comp instanceof JButton) {
|
||||
JButton button = (JButton)comp;
|
||||
String name = button.getText();
|
||||
if (name != null)
|
||||
button.setText(LangUtil.translate(name));
|
||||
}
|
||||
if (comp instanceof JLabel) {
|
||||
JLabel button = (JLabel)comp;
|
||||
String name = button.getText();
|
||||
if (name != null)
|
||||
button.setText(LangUtil.translate(name));
|
||||
}
|
||||
return super.add(comp);
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,7 @@ import org.diylc.images.IconLoader;
|
||||
import org.diylc.lang.LangUtil;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.gui.TranslatedPanel;
|
||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.plugins.canvas.CanvasPanel;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
@@ -172,7 +173,7 @@ public class LoadlineEditorFrame extends JFrame implements IView {
|
||||
|
||||
public JPanel getToolbar() {
|
||||
if (toolbar == null) {
|
||||
toolbar = new JPanel();
|
||||
toolbar = new TranslatedPanel();
|
||||
toolbar.add(new JButton(new ClearAction()));
|
||||
toolbar.add(new JButton(new LoadAction()));
|
||||
toolbar.add(new JButton(new SaveAction()));
|
||||
@@ -253,7 +254,7 @@ public class LoadlineEditorFrame extends JFrame implements IView {
|
||||
|
||||
public JPanel getControlPanel() {
|
||||
if (controlPanel == null) {
|
||||
controlPanel = new JPanel();
|
||||
controlPanel = new TranslatedPanel();
|
||||
|
||||
controlPanel.add(new JLabel("Name: "));
|
||||
controlPanel.add(getNameEditor());
|
||||
|
||||
Reference in New Issue
Block a user