Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package hr.fer.tel.ftm.gui;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.Dimension;
- import java.awt.EventQueue;
- import java.awt.FlowLayout;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.JScrollPane;
- import javax.swing.border.EmptyBorder;
- import javax.swing.GroupLayout;
- import javax.swing.GroupLayout.Alignment;
- import javax.swing.border.EtchedBorder;
- import javax.swing.LayoutStyle.ComponentPlacement;
- import javax.swing.ScrollPaneConstants;
- import javax.swing.JLabel;
- import javax.swing.JComboBox;
- import javax.swing.JFileChooser;
- import javax.imageio.ImageIO;
- import javax.swing.BorderFactory;
- import javax.swing.BoxLayout;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.JButton;
- import java.awt.event.ActionListener;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Timer;
- import java.util.TimerTask;
- import java.awt.event.ActionEvent;
- import java.awt.Font;
- import java.awt.Image;
- import java.awt.SystemColor;
- import javax.swing.border.MatteBorder;
- import com.sun.glass.ui.Screen;
- import hr.fer.tel.ftm.komponente.AddDropMux;
- import hr.fer.tel.ftm.komponente.Pojacalo;
- import hr.fer.tel.ftm.komponente.Spreznik;
- import hr.fer.tel.ftm.komponente.Raspreznik;
- import hr.fer.tel.ftm.komponente.DeMux;
- import hr.fer.tel.ftm.komponente.ElectricalComponent;
- import hr.fer.tel.ftm.komponente.Vlakno;
- import hr.fer.tel.ftm.komponente.Filter;
- import hr.fer.tel.ftm.komponente.Mux;
- import hr.fer.tel.ftm.komponente.Prijemnik;
- import hr.fer.tel.ftm.komponente.Signal;
- import hr.fer.tel.ftm.komponente.Prospojnik;
- import hr.fer.tel.ftm.komponente.Predajnik;
- import javax.swing.SwingConstants;
- import javax.swing.SwingUtilities;
- import javax.swing.ImageIcon;
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import java.io.File;
- import java.io.IOException;
- public class FtmGui extends JFrame {
- private static final long serialVersionUID = 36949826489632L;
- public JFileChooser fc = new JFileChooser();
- public static FtmGui frame;
- public boolean isFullScreen = false;
- public boolean isHeightChanged = false;
- private JPanel contentPane;
- public static JPanel panelCommands;
- public static JPanel panelPlay;
- static ImprovedPanel panelSchema;
- private JPanel panel;
- public static JPanel simulationPanel;
- private JLabel lblComponent;
- private JButton btnAddComponent;
- private JButton btnSimulate;
- // private JButton btnCalculateLink;
- public static JLabel simulationFeedbackLabel;
- public static JLabel simulationFeedbackText;
- private DefaultComboBoxModel<ElectricalComponent> comboBoxComponentModel;
- private JComboBox<ElectricalComponent> comboBoxComponent;
- static State state;
- public static List<ConnectedGuiElements> connectedElementsList = new ArrayList<ConnectedGuiElements>();
- private Timer timer = new Timer();
- private JButton btnFullScreen;
- class PaintCurrentState extends TimerTask {
- public void run() {
- panelSchema.paintFiber(panelSchema.getGraphics());
- }
- }
- /**
- * Create the frame.
- * @throws IOException
- */
- public FtmGui() throws IOException {
- initComponents();
- initEvents();
- state = new State();
- timer.schedule(new PaintCurrentState(), 0, 100);
- }
- private void initComponents() throws IOException {
- // Main initialization
- setTitle("FTM - Simulator optičkih komponenti");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setExtendedState(MAXIMIZED_BOTH);
- setBounds(0, 0, 1366, 800);
- contentPane = new JPanel();
- contentPane.setBackground(new Color(255, 255, 255));
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- // Initialize panelCommands
- panelCommands = new JPanel();
- panelCommands.setBackground(Color.GRAY);
- panelCommands.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
- panelPlay = new JPanel();
- panelPlay.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
- // Initialize panelCommands components
- btnAddComponent = new JButton("+");
- btnAddComponent.setFont(new Font("Tahoma", Font.BOLD, 30));
- btnSimulate = new JButton();
- btnSimulate.setFont(new Font("Tahoma", Font.BOLD, 12));
- comboBoxComponent = new JComboBox<ElectricalComponent>();
- comboBoxComponent.setFont(new Font("Tahoma", Font.BOLD, 20));
- comboBoxComponent.setBackground(new Color(255, 255, 255));
- comboBoxComponentModel = new DefaultComboBoxModel<>();
- comboBoxComponentModel.addElement(new AddDropMux());
- comboBoxComponentModel.addElement(new DeMux());
- comboBoxComponentModel.addElement(new Filter());
- comboBoxComponentModel.addElement(new Mux());
- comboBoxComponentModel.addElement(new Pojacalo());
- comboBoxComponentModel.addElement(new Predajnik());
- comboBoxComponentModel.addElement(new Prijemnik());
- comboBoxComponentModel.addElement(new Prospojnik());
- comboBoxComponentModel.addElement(new Raspreznik());
- comboBoxComponentModel.addElement(new Spreznik());
- comboBoxComponent.setModel(comboBoxComponentModel);
- // Initialize panelSchema
- panelSchema = new ImprovedPanel();
- panelSchema.setBackground(new Color(235, 235, 235));
- panelSchema.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
- panelSchema.setLayout(null);
- // Feedback panel
- panel = new JPanel();
- panel.setToolTipText("Ako je validacija uspje\u0161na, nema unutarnjih programskih gre\u0161aka.");
- panel.setBorder(new MatteBorder(2, 2, 2, 2, (Color) new Color(0, 51, 153)));
- panel.setBackground(SystemColor.info);
- panel.setLayout(null);
- simulationFeedbackLabel = new JLabel("Rezultat validacije");
- simulationFeedbackLabel.setForeground(Color.BLACK);
- simulationFeedbackLabel.setHorizontalAlignment(SwingConstants.CENTER);
- simulationFeedbackLabel.setBounds(10, 9, 184, 19);
- panel.add(simulationFeedbackLabel);
- simulationFeedbackLabel.setBackground(Color.WHITE);
- simulationFeedbackLabel.setFont(new Font("Cambria Math", Font.BOLD | Font.ITALIC, 16));
- panelSchema.setPreferredSize(new Dimension(1920,1080-300));
- panelPlay.setPreferredSize(new Dimension(1920, 100));
- panelPlay.setLayout(new BorderLayout());
- panelCommands.setLayout(new BorderLayout());
- contentPane.add(panelCommands);
- contentPane.add(panelSchema);
- contentPane.add(panelPlay);
- JLabel lblOptions = new JLabel("Opcije:");
- lblOptions.setForeground(Color.WHITE);
- lblOptions.setFont(new Font("Tahoma", Font.BOLD, 12));
- JButton btnZoomIn = new JButton("Zoom In");
- btnZoomIn.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- panelSchema.setSize(panelSchema.getSize().width - 50, panelSchema.getSize().height - 50);
- }
- });
- btnZoomIn.setFont(new Font("Tahoma", Font.PLAIN, 12));
- JButton btnZoomOut = new JButton("Zoom Out");
- btnZoomOut.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- panelSchema.setSize(panelSchema.getSize().width + 50, panelSchema.getSize().height + 50);
- }
- });
- btnZoomOut.setFont(new Font("Tahoma", Font.PLAIN, 12));
- JButton btnImport = new JButton("Import");
- btnImport.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- FileChooserDemo fcd = new FileChooserDemo();
- fc.setCurrentDirectory(new File(System.getProperty("user.home")));
- int result = fc.showOpenDialog(fcd);
- if (result == JFileChooser.APPROVE_OPTION) {
- File selectedFile = fc.getSelectedFile();
- System.out.println("Selected file: " + selectedFile.getAbsolutePath());
- }
- }
- });
- btnImport.setFont(new Font("Tahoma", Font.PLAIN, 12));
- JButton btnExport = new JButton("Export");
- btnExport.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- FileChooserDemo fcd = new FileChooserDemo();
- fc.setCurrentDirectory(new File(System.getProperty("user.home")));
- int result = fc.showOpenDialog(fcd);
- if (result == JFileChooser.APPROVE_OPTION) {
- File selectedFile = fc.getSelectedFile();
- System.out.println("Selected file: " + selectedFile.getAbsolutePath());
- }
- }
- });
- btnExport.setFont(new Font("Tahoma", Font.PLAIN, 12));
- JButton btnHelp = new JButton();
- btnHelp.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- createHelpFrame();
- }
- });
- btnHelp.setIcon(null);
- btnHelp.setSelectedIcon(null);
- btnHelp.setFont(new Font("Tahoma", Font.PLAIN, 12));
- btnFullScreen = new JButton();
- btnFullScreen.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/fullscreen.png")));
- btnFullScreen.setFont(new Font("Tahoma", Font.PLAIN, 12));
- btnFullScreen.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- if (!isFullScreen) {
- isFullScreen = true;
- frame.dispose();
- frame.setUndecorated(true);
- frame.setExtendedState(MAXIMIZED_BOTH);
- frame.setVisible(true);
- panelSchema.setPreferredSize(new Dimension(1920, 1080-220));
- btnFullScreen.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/windowed.png")));
- } else if (isFullScreen) {
- isFullScreen = false;
- frame.dispose();
- frame.setUndecorated(false);
- frame.setExtendedState(MAXIMIZED_BOTH);
- frame.setVisible(true);
- panelSchema.setPreferredSize(new Dimension(1920, 1080-300));
- btnFullScreen.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/fullscreen.png")));
- }
- }
- });
- simulationPanel = new JPanel();
- simulationPanel.setLayout(null);
- simulationPanel.setToolTipText("Ako je simulacija uspješna, nema grešaka u optièkoj mreži.");
- simulationPanel.setPreferredSize(new Dimension(76,76));
- panel.setPreferredSize(new Dimension(30,30));
- simulationFeedbackText = new JLabel();
- simulationFeedbackText.setHorizontalAlignment(SwingConstants.CENTER);
- simulationFeedbackText.setFont(new Font("Cambria Math", Font.BOLD | Font.ITALIC, 16));
- simulationFeedbackText.setBackground(Color.WHITE);
- simulationFeedbackText.setBounds(10, 9, 184, 19);
- simulationPanel.add(simulationFeedbackText);
- panelCommands.setPreferredSize(new Dimension(1920, 100));
- comboBoxComponent.setPreferredSize(new Dimension(60, 60));
- btnAddComponent.setPreferredSize(new Dimension(60, 60));
- btnAddComponent.setPreferredSize(new Dimension(74, 74));
- btnHelp.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/information.png")));
- btnSimulate.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/music-and-multimedia.png")));
- JPanel panelaRight = new JPanel();
- panelaRight.setLayout(new BorderLayout());
- btnHelp.setOpaque(false);
- btnHelp.setContentAreaFilled(false);
- btnHelp.setBorderPainted(false);
- btnAddComponent.setOpaque(false);
- btnAddComponent.setContentAreaFilled(false);
- btnAddComponent.setBorderPainted(false);
- btnSimulate.setOpaque(false);
- btnSimulate.setContentAreaFilled(false);
- btnSimulate.setBorderPainted(false);
- btnFullScreen.setOpaque(false);
- btnFullScreen.setContentAreaFilled(false);
- btnFullScreen.setBorderPainted(false);
- panelaRight.add(btnHelp, BorderLayout.LINE_END);
- panelCommands.add(panelaRight,BorderLayout.LINE_END);
- JPanel panelaLeft = new JPanel();
- panelaLeft.setLayout(new BorderLayout());
- panelaLeft.add(comboBoxComponent);
- panelaLeft.add(btnAddComponent, BorderLayout.LINE_END);
- panelCommands.add(panelaLeft,BorderLayout.LINE_START);
- panelaLeft.setPreferredSize(new Dimension(500,100));
- JPanel panelaLeftRight = new JPanel();
- panelaLeftRight.setLayout(new BorderLayout());
- panelaLeftRight.add(simulationPanel, BorderLayout.CENTER);
- panelCommands.add(panelaLeftRight);
- panelPlay.add(btnSimulate,BorderLayout.LINE_START);
- panelPlay.add(btnFullScreen,BorderLayout.EAST);
- }
- protected void createHelpFrame() {
- EventQueue.invokeLater(new Runnable() {
- @Override
- public void run() {
- JFrame frame = new JFrame("Upute za korištenje");
- JPanel panel = new JPanel();
- panel.setBackground(Color.WHITE);
- panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
- panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
- JLabel label = new JLabel();
- label.setAlignmentX(0.55f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/1.jpg")));
- panel.add(label);
- label = new JLabel();
- label.setAlignmentX(0.85f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/2.jpg")));
- panel.add(label);
- label = new JLabel();
- label.setAlignmentX(0.80f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/3.jpg")));
- panel.add(label);
- label = new JLabel();
- label.setAlignmentX(0.95f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/4.jpg")));
- panel.add(label);
- label = new JLabel();
- label.setAlignmentX(0.625f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/5.jpg")));
- panel.add(label);
- label = new JLabel();
- label.setAlignmentX(0.725f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/6.jpg")));
- panel.add(label);
- label = new JLabel();
- label.setAlignmentX(0.83f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/7.jpg")));
- panel.add(label);
- label = new JLabel();
- label.setAlignmentX(0.725f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/8.jpg")));
- panel.add(label);
- label = new JLabel();
- label.setAlignmentX(0.70f);
- label.setIcon(new ImageIcon(FtmGui.class.getResource("/slike/9.jpg")));
- panel.add(label);
- JScrollPane scroller = new JScrollPane(panel);
- scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
- scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
- scroller.setBounds(0, 0, 1366 - 115, 768 - 135);
- JPanel contentPane = new JPanel(null);
- contentPane.setPreferredSize(new Dimension(1920, 1080));
- contentPane.add(scroller);
- frame.setContentPane(contentPane);
- frame.pack();
- frame.setBounds(50, 50, 1366 - 100, 768 - 100);
- frame.setVisible(true);
- frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- frame.setResizable(false);
- }
- });
- }
- private void initEvents() {
- // Add component to panelSchema
- btnAddComponent.addActionListener(new ActionListener() {
- // When user press "Add Component"
- public void actionPerformed(ActionEvent arg0) {
- ElectricalComponent selectedInstrumentType = (ElectricalComponent) comboBoxComponent.getSelectedItem();
- // Make new gui component
- GuiElectricalComponent newComp = selectedInstrumentType.getGuiComponentInstance();
- newComp.setToolTipText("Pritisnite desni klik miša za unos parametara komponente.");
- // Add component to schema
- panelSchema.add(newComp);
- newComp.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseReleased(MouseEvent arg0) {
- if (SwingUtilities.isRightMouseButton(arg0)) {
- String className = selectedInstrumentType.getClass().toString();
- int lastIndxDot = className.lastIndexOf('.');
- className = className.substring(lastIndxDot + 1, className.length());
- if (!isHeightChanged) {
- isHeightChanged = true;
- switch (className) {
- case "AddDropMux":
- newComp.setSize(newComp.getWidth(), 181);
- break;
- case "DeMux":
- newComp.setSize(newComp.getWidth(), 141);
- break;
- case "Filter":
- newComp.setSize(newComp.getWidth(), 181);
- break;
- case "Mux":
- newComp.setSize(newComp.getWidth(), 141);
- break;
- case "Pojacalo":
- newComp.setSize(newComp.getWidth(), 221);
- break;
- case "Predajnik":
- newComp.setSize(newComp.getWidth(), 221);
- break;
- case "Prijemnik":
- newComp.setSize(newComp.getWidth(), 201);
- break;
- case "Prospojnik":
- newComp.setSize(newComp.getWidth(), 141);
- break;
- case "Raspreznik":
- newComp.setSize(newComp.getWidth(), 141);
- break;
- case "Spreznik":
- newComp.setSize(newComp.getWidth(), 141);
- break;
- }
- } else if (isHeightChanged) {
- isHeightChanged = false;
- newComp.setSize(newComp.getWidth(), 100);
- }
- }
- }
- });
- // Repaint GUI to display new component
- panelSchema.repaint();
- panelSchema.paintFiber(panelSchema.getGraphics());
- }
- });
- // Simulate
- btnSimulate.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- Timer simulationTimer = new Timer();
- Timer simulationTimer2 = new Timer();
- defaultSimulationFeedback(simulationTimer);
- defaultSimulationFeedbackText(simulationTimer2);
- setDefaltTextToComponents("Nije detektiran signal.");
- if (!validateSchema()) {
- failedSimulationFeedback(simulationTimer);
- return;
- }
- /*
- * Display received signal
- */
- for (ConnectedGuiElements connectedElements : connectedElementsList) {
- boolean isLastComponentInChain = true;
- // check if component is last in schema chain of connected
- // components
- for (ConnectedGuiElements subConnectedGuiElements : connectedElementsList) {
- if (connectedElements.getInComp().equals(subConnectedGuiElements.getOutComp())) {
- isLastComponentInChain = false;
- }
- }
- // if component is last in chain call the receive signal
- // function
- if (isLastComponentInChain) {
- ArrayList<Signal> receivedSignalList = receiveSignal(connectedElements);
- connectedElements.getInComp().setTextInfoAboutSignal(receivedSignalList);
- }
- }
- successfulSimulatioFeedback(simulationTimer);
- }
- });
- }
- /*
- * Recursive function for link calculation
- */
- public static void calculateLink(ConnectedGuiElements connectedElements, double sensitivity) {
- GuiElectricalComponent inComponent = connectedElements.getInComp();
- GuiElectricalComponent outComponent = connectedElements.getOutComp();
- GuiElectricalComponent connectingFiber = connectedElements.getConnectingFiber();
- // inComponent
- double inComponentPowerBeforeLoss = inComponent.getInstrument().componentCalculateLink(sensitivity);
- // Fiber
- double fiberPowerBeforeLoss = connectingFiber.getInstrument()
- .componentCalculateLink(inComponentPowerBeforeLoss);
- // outComponentHandler
- outComponent.getInstrument().callNextComponentToCalculateLink(fiberPowerBeforeLoss, outComponent);
- }
- /*
- * Recursive function for simulation
- */
- public static ArrayList<Signal> receiveSignal(ConnectedGuiElements connectedElements) {
- GuiElectricalComponent inComponent = connectedElements.getInComp();
- int inComponentConnection = connectedElements.getInCompConnection();
- GuiElectricalComponent outComponent = connectedElements.getOutComp();
- int outComponentConnection = connectedElements.getOutCompConnection();
- GuiElectricalComponent connectingFiber = connectedElements.getConnectingFiber();
- ArrayList<Signal> inputSignalList = new ArrayList<>();
- inputSignalList.add(new Signal(-1, new ArrayList<>()));
- ArrayList<Signal> afterFiberSignalList = null;
- ArrayList<Signal> outputSignalList = null;
- inputSignalList = outComponent.getInstrument().outComponentReceiveSignal(outComponent);
- outComponent.setTextInfoAboutSignal(inputSignalList);
- afterFiberSignalList = connectingFiber.getInstrument().work(inputSignalList, -1, -1);
- outputSignalList = inComponent.getInstrument().work(afterFiberSignalList, outComponentConnection,
- inComponentConnection);
- return outputSignalList;
- }
- /*
- * Run default simulate loading animation
- */
- public void defaultSimulationFeedback(Timer timer) {
- String text = "...";
- simulationFeedbackLabel.setText("");
- simulationFeedbackLabel.setForeground(new Color(0, 0, 0));
- timer.schedule(new TimerTask() {
- @Override
- public void run() {
- if (simulationFeedbackLabel.getText().length() == text.length()) {
- return;
- }
- simulationFeedbackLabel.setText(text.substring(0, simulationFeedbackLabel.getText().length() + 1));
- }
- }, 0, 40);
- }
- /*
- * Run default simulate loading animation
- */
- public void defaultSimulationFeedbackText(Timer timer) {
- String text = "...";
- simulationFeedbackText.setText("");
- simulationFeedbackText.setForeground(new Color(0, 0, 0));
- timer.schedule(new TimerTask() {
- @Override
- public void run() {
- if (simulationFeedbackText.getText().length() == text.length()) {
- return;
- }
- }
- }, 0, 40);
- }
- /*
- * Failed simulation feedback
- */
- public void failedSimulationFeedback(Timer timer) {
- timer.schedule(new TimerTask() {
- @Override
- public void run() {
- timer.cancel();
- simulationFeedbackLabel.setForeground(Color.RED);
- panel.setToolTipText("Došlo je do pogreške prilikom upisivanja parametara");
- simulationPanel.setForeground(Color.RED);
- simulationPanel.setToolTipText("Došlo je do pogreške prilikom upisivanja parametara");
- }
- }, 460);
- }
- /*
- * Successful simulation feedback
- */
- public void successfulSimulatioFeedback(Timer timer) {
- timer.schedule(new TimerTask() {
- @Override
- public void run() {
- timer.cancel();
- simulationFeedbackLabel.setForeground(new Color(10, 128, 20));
- panel.setToolTipText("Validacija je uspješna");
- if(panelSchema.getComponentCount() == 0) {
- simulationPanel.setBackground(Color.RED);
- simulationPanel.setToolTipText("Na panel nije postavljena niti jedna komponenta");
- }
- }
- }, 460);
- }
- /*
- * Set default tooltiptext to all components except fiber
- */
- public static void setDefaltTextToComponents(String text) {
- boolean first = false;
- for (int i = 0; i < panelSchema.getComponentCount(); i++) {
- GuiElectricalComponent component = (GuiElectricalComponent) panelSchema.getComponent(i);
- if (component.getInstrument() instanceof Vlakno) {
- component.setToolTipText("Ovo je vlakno");
- continue;
- }
- component.setToolTipText(text);
- if(!first) {
- first = true;
- String className = component.getName();
- int lastIndxDot = className.lastIndexOf('.');
- className = className.substring(lastIndxDot + 1, className.length());
- simulationPanel.setToolTipText("Na komponenti " + className +" nije detektiran signal");
- }
- component.setBorder(new MatteBorder(2, 2, 2, 2, (Color) new Color(255,0,0)));
- simulationPanel.setBackground(Color.RED);
- }
- first = false;
- }
- /*
- * Validate panel schema setup
- */
- public boolean validateSchema() {
- for (int i = 0; i < panelSchema.getComponentCount(); i++) {
- GuiElectricalComponent component = (GuiElectricalComponent) panelSchema.getComponent(i);
- if (!component.getInstrument().validate()) {
- return false;
- }
- }
- return true;
- }
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- frame = new FtmGui();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement