package com.fr.env; import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Locale; /** * 插件启动失败提示窗 */ public class PluginErrorRemindDialog extends JDialog implements ActionListener { public PluginErrorRemindDialog(Frame parent, String areaText) { super(parent, true); //上面的标签面板 JPanel topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel imagePanel = new JPanel(); Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning5.png"); JLabel imageLabel = new JLabel(); imageLabel.setIcon(icon); imagePanel.add(imageLabel); imagePanel.setPreferredSize(new Dimension(130, 100)); JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Title")); label.setFont(FRFont.getInstance().applySize(18).applyStyle(1)); label.setPreferredSize(new Dimension(650, 100)); verticalPanel.add(label); topPanel.add(imagePanel, BorderLayout.WEST); topPanel.add(verticalPanel, BorderLayout.CENTER); topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); //中间的文本域面板 JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); centerPanel.setPreferredSize(new Dimension(480, 320)); JTextArea checkArea = new JTextArea(areaText); checkArea.setEnabled(false); centerPanel.add(checkArea, BorderLayout.CENTER); UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Not_Deal_With")); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Deal_With")); cancelButton.addActionListener(this); okButton.addActionListener(new PluginManagerActionAdapter(this)); // 按钮 JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); buttonPanel.add(cancelButton); buttonPanel.add(okButton); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")); this.setResizable(false); this.add(topPanel, BorderLayout.NORTH); this.add(centerPanel, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.SOUTH); this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US) ? 750 : 600, 500)); GUICoreUtils.centerWindow(this); } @Override public void actionPerformed(ActionEvent e) { this.dispose(); } private static class PluginManagerActionAdapter extends PluginManagerAction { private JDialog jDialog; public PluginManagerActionAdapter(JDialog jDialog) { this.jDialog = jDialog; } @Override public void actionPerformed(ActionEvent e) { this.jDialog.dispose(); super.actionPerformed(e); } } }