Пример #1
0
 public FastDisplay()
 {
     image   = null;
     frame   = null;
     t       = new Timer();
     frames  = 0;
     seconds = 0;
 }
Пример #2
0
 public FastDisplay()
 {
     image = null;
     frame = null;
     t = new Timer();
     frames = 0;
     seconds = 0;
 }
Пример #3
0
 /**
  * Auto-generated main method to display this JPanel inside a new JFrame.
  */
 public static void main(string[] args)
 {
     JFrame frame = new JFrame();
     frame.getContentPane().add(new RenderGlobalsPanel());
     frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
     frame.pack();
     frame.setVisible(true);
 }
Пример #4
0
        /// <summary>
        /// Constructor. </summary>
        /// <param name="parent"> the JFrame on which to display this dialog.  Must not be null. </param>
        /// <param name="dataset"> the dataset that is being worked with. </param>
        /// <param name="datasetWindowManager"> the window manager that is managing this window. </param>
        public StateMod_Save_JDialog(JFrame parent, StateMod_DataSet dataset, StateMod_DataSet_WindowManager datasetWindowManager) : base(parent, "Save Modified StateMod Files", true)
        {
            __dataset    = dataset;
            __dataset_wm = datasetWindowManager;
            __parent     = parent;

            setupGUI();
        }
Пример #5
0
        /**
         * Auto-generated main method to display this JPanel inside a new JFrame.
         */
        public static void main(string[] args)
        {
            JFrame frame = new JFrame();

            frame.getContentPane().add(new RenderGlobalsPanel());
            frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        }
 /// <summary>
 /// Construct a StateCU_DataSet_JFrame.  The data set should be set when available
 /// using setDataSet(). </summary>
 /// <param name="parent"> JFrame from which this instance is constructed. </param>
 /// <param name="display_data_objects"> If true, data objects are listed in the tree.  If
 /// false, only the top-level data set components are listed. </param>
 public StateCU_DataSet_JTree(JFrame parent, bool display_data_objects)
 {
     __display_data_objects = display_data_objects;
     __folderIcon           = getClosedIcon();
     showRootHandles(true);
     addMouseListener(this);
     setLeafIcon(null);
     setTreeTextEditable(false);
     __popup_JPopupMenu = new JPopupMenu();
 }
Пример #7
0
        public static void Main(String[] args)
        {
            Robot robot = new Robot();

            size = Toolkit.GetDefaultToolkit().GetScreenSize();
            JFrame  frame  = new JFrame("Ghost Mouse (tm)!");
            JButton button = new JButton("Gho Ghost");

            frame.GetContentPane().Add(button);
            button.AddActionListener(new CircleListener(robot));
            frame.Pack();
            frame.SetLocation((int)(size.Width - frame.GetWidth()) / 2, (int)(size.Height - frame.GetHeight()) / 2);
            frame.SetVisible(true);
        }
        /// <summary>
        /// Construct a StateMod_DataSet_JFrame. </summary>
        /// <param name="parent"> JFrame from which this instance is constructed. </param>
        /// <param name="dataset"> StateMod_DataSet that is being displayed/managed. </param>
        /// <param name="dataset_wm"> the dataset window manager or null if the data set windows are not being managed. </param>
        /// <param name="display_data_objects"> If true, data objects are listed in the tree.  If </param>
        /// <param name="editable"> If true, data objects can be edited.
        /// false, only the top-level data set components are listed. </param>
        public StateMod_DataSet_JTree(JFrame parent, StateMod_DataSet dataset, StateMod_DataSet_WindowManager dataset_wm, bool display_data_objects, bool editable)
        {
            __dataset              = dataset;
            __dataset_wm           = dataset_wm;
            __display_data_objects = display_data_objects;
            __editable             = editable;

            __folderIcon = getClosedIcon();

            showRootHandles(true);
            addMouseListener(this);
            setLeafIcon(null);
            setTreeTextEditable(false);
            __popup_JPopupMenu = new JPopupMenu();
        }
        /// <summary>
        /// Sets the title in a uniform fashion, as determined by the values passed in.
        /// The general pattern of the title will be
        /// "AppName - DataSet Base Name - Window Name (status)" </summary>
        /// <param name="frame"> the frame on which to set the title.  Cannot be null. </param>
        /// <param name="dataset"> the dataset from which to get the base dataset name.   The
        /// basename can be null or "", in which case it won't be included in the title.
        /// The dataset can be null. </param>
        /// <param name="window_title"> the title of the window.  Can be null or "", in which
        /// case it won't be included in the title. </param>
        /// <param name="status"> the status of the window.  Can be null or "", in which case
        /// it won't be included in the title. </param>
        public static void setTitle(JFrame frame, DataSet dataset, string window_title, string status)
        {
            string title = "";
            int    count = 0;

            string appName = JGUIUtil.getAppNameForWindows().Trim();

            if (!appName.Trim().Equals(""))
            {
                title += appName;
                count++;
            }

            if (dataset != null)
            {
                string basename = dataset.getBaseName();
                if (!string.ReferenceEquals(basename, null) && !basename.Trim().Equals(""))
                {
                    if (count > 0)
                    {
                        title += " - ";
                    }
                    title += basename.Trim();
                    count++;
                }
            }

            if (!string.ReferenceEquals(window_title, null) && !window_title.Trim().Equals(""))
            {
                if (count > 0)
                {
                    title += " - ";
                }
                title += window_title.Trim();
                count++;
            }

            if (!string.ReferenceEquals(status, null) && !status.Trim().Equals(""))
            {
                if (count > 0)
                {
                    title += " ";
                }
                title += "(" + status + ")";
            }

            frame.setTitle(title);
        }
Пример #10
0
 public UIProgressBarDialog(JFrame paramJFrame, string paramString, int paramInt) : base(paramJFrame, paramString, false)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     setSize(380, 130);
     Modal = true;
     init(paramInt);
     Resizable = false;
     if (paramJFrame != null)
     {
         this.previousFocus = paramJFrame.MostRecentFocusOwner;
     }
 }
Пример #11
0
        public static void main(string[] args)
        {
            JFrame jframe = new JFrame();

            jframe.setTitle("Debug");
            jframe.setDefaultCloseOperation(3);
            jframe.pack();
            jframe.setVisible(false);
            FilenameDialog filenameDialog = new FilenameDialog(jframe, true, "Save as...");

            [email protected]("Showing dialog...");
            filenameDialog.setVisible(true);
            string text = filenameDialog.getFilename();

            [email protected](new StringBuilder().append("Filename: ").append(text).append(" (length = ").append(String.instancehelper_length(text)).append(')').toString());
            java.lang.System.exit(0);
        }
Пример #12
0
    public LightSwitch()
    {
        button  = new ToggleButton("off", "on");
        counter = new BinaryCounter(0);
        button.addActionListener(counter);
        JPanel contentPane = new JPanel();

        contentPane.add(button);
        contentPane.add(counter);
        JFrame frame = new JFrame("LightSwitch");

        frame.DefaultCloseOperation = JFrame.EXIT_ON_CLOSE;
        frame.ContentPane           = contentPane;
        frame.pack();
        frame.setSize(500, 200);
        frame.Visible = true;
    }
Пример #13
0
        public static void initGui(MinecraftServer minecraftserver)
        {
            try
            {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            }
            catch (Exception)
            {
            }
            var servergui = new ServerGUI(minecraftserver);
            var jframe    = new JFrame("Minecraft server");

            jframe.add(servergui);
            jframe.pack();
            jframe.setLocationRelativeTo(null);
            jframe.setVisible(true);
            jframe.addWindowListener(new ServerWindowAdapter(minecraftserver));
        }
Пример #14
0
        /**
         * Main program (used when run as application instead of applet).
         */
        public static void main(String[] args)
        {
            DelaunayAp applet = new DelaunayAp();              // Create applet

            applet.init();                                     // Perform applet initialization
            JFrame dWindow = new JFrame();                     // Create window

            dWindow.setSize(700, 500);                         // Set window size
            dWindow.setTitle("Voronoi/Delaunay Window");
            // Set window title
            dWindow.getContentPane().setLayout(new BorderLayout());
            // Specify layout manager
            dWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // Specify closing behavior
            dWindow.getContentPane().add(applet, "Center");
            // Place applet into window
            dWindow.setVisible(true);                          // Show the window
        }
Пример #15
0
        public BoardAbstract(int width, int height, JFrame frame)
        {
            currentState = updatingState;

            B_WIDTH   = width;
            B_HEIGHT  = height;
            mainFrame = frame;

            console = new Console(20, B_HEIGHT - 200, this);
            //slidingMessageQueue = new ConcurrentHashMap<>();
            slidingMessageQueue = new ArrayList <>();
            frame.addMouseWheelListener(this);
            frame.addKeyListener(this);

            /*  editorPanel = new EditorPanel(this);
             * editorPanel.setSize(new Dimension(240, 300));
             * editorPanel.setPreferredSize(new Dimension(240, 300));*/
        }
Пример #16
0
 private void CreateAndShowGUI()
 {
     //Make sure we have nice window decorations.
     JFrame.SetDefaultLookAndFeelDecorated(true);
     //Create and set up the window.
     frame = new JFrame("Stanford Named Entity Recognizer");
     frame.SetDefaultCloseOperation(WindowConstantsConstants.ExitOnClose);
     frame.GetContentPane().SetLayout(new BorderLayout());
     frame.GetContentPane().SetSize(Width, Height);
     frame.SetJMenuBar(AddMenuBar());
     //frame.setSize(new Dimension(WIDTH, HEIGHT));
     frame.SetSize(Width, Height);
     BuildTagPanel();
     BuildContentPanel();
     //Display the window.
     frame.Pack();
     frame.SetSize(Width, Height);
     frame.SetVisible(true);
 }
Пример #17
0
        public __Form()
        {
            this.InternalElement = new JFrame();
            //this.InternalElement = new JDialog();
            this.InternalElement.setSize(300, 300);

            this.InternalElement.getContentPane().setLayout(null);

            // fixme: jsc should make delegate methods public!
            // java cannot call them otherwise

            this.InternalElement.addWindowListener(
                new __WindowListener
            {
                Closed  = RaiseFormClosed,
                Closing = RaiseFormClosing,
            }

                );
        }
Пример #18
0
				public void hierarchyChanged(HierarchyEvent param1HierarchyEvent)
				{
				  if (CostOSRootPaneUI.this.root == null)
				  {
					return;
				  }
				  Window window = SwingUtilities.getWindowAncestor(CostOSRootPaneUI.this.root);
				  if (window is Frame)
				  {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final javax.swing.JFrame f = (javax.swing.JFrame)window;
					JFrame f = (JFrame)window;
					if (jFrame != null && !jFrame.Displayable && !jFrame.Undecorated && isFirst)
					{
					  CostOSRootPaneUI.this.root.WindowDecorationStyle = 1;
					  jFrame.Undecorated = true;
					  if (string.Compare("mac os x", System.getProperty("os.name"), StringComparison.OrdinalIgnoreCase) != 0)
					  {
//JAVA TO C# CONVERTER TODO TASK: The following line could not be converted:
						jFrame.addComponentListener(new [email protected]()
						{
Пример #19
0
        /// <exception cref="System.IO.IOException"/>
        public static void Main(string[] args)
        {
            TreeJPanel tjp = new TreeJPanel();
            // String ptbTreeString1 = "(ROOT (S (NP (DT This)) (VP (VBZ is) (NP (DT a) (NN test))) (. .)))";
            string ptbTreeString = "(ROOT (S (NP (NNP Interactive_Tregex)) (VP (VBZ works)) (PP (IN for) (PRP me)) (. !))))";

            if (args.Length > 0)
            {
                ptbTreeString = args[0];
            }
            Tree tree = (new PennTreeReader(new StringReader(ptbTreeString), new LabeledScoredTreeFactory(new StringLabelFactory()))).ReadTree();

            tjp.SetTree(tree);
            tjp.SetBackground(Color.white);
            JFrame frame = new JFrame();

            frame.GetContentPane().Add(tjp, BorderLayout.Center);
            frame.AddWindowListener(new _WindowAdapter_256());
            frame.Pack();
            frame.SetVisible(true);
            frame.SetVisible(true);
        }
Пример #20
0
 public virtual void show()
 {
     if (this.frame == null)
     {
         this.frame = new JFrame();
         JMenuBar jMenuBar = new JMenuBar();
         JMenu    jMenu    = new JMenu("File");
         jMenuBar.add(jMenu);
         JMenuItem jMenuItem = new JMenuItem(" Save...   ");
         jMenuItem.addActionListener(this);
         jMenuItem.setAccelerator(KeyStroke.getKeyStroke(83, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
         jMenu.add(jMenuItem);
         this.frame.setJMenuBar(jMenuBar);
         this.frame.setContentPane(this.getJLabel());
         this.frame.setDefaultCloseOperation(2);
         this.frame.setTitle(this.filename);
         this.frame.setResizable(false);
         this.frame.pack();
         this.frame.setVisible(true);
     }
     this.frame.repaint();
 }
Пример #21
0
        private void displayWeight(List <double?> currentKernel)
        {
            JFrame frame = new JFrame("Weight Visualiser: ");

            frame.setSize(400, 400);

            JLabel    label = new JLabel();
            Dimension d     = new Dimension(kernel.Width * RATIO, kernel.Height * RATIO);

            label.Size          = d;
            label.PreferredSize = d;

            frame.ContentPane.add(label, BorderLayout.CENTER);
            frame.pack();
            frame.Visible = true;

            BufferedImage image = new BufferedImage(kernel.Width, kernel.Height, BufferedImage.TYPE_BYTE_GRAY);

            int[] rgb = convertWeightToRGB(currentKernel);
            image.setRGB(0, 0, kernel.Width, kernel.Height, rgb, 0, kernel.Width);
            label.Icon = new ImageIcon(image.getScaledInstance(kernel.Width * RATIO, kernel.Height * RATIO, Image.SCALE_SMOOTH));
        }
Пример #22
0
 public void imageBegin(int w, int h, int bucketSize)
 {
     lock (lockObj)
     {
         if (frame != null && image != null && w == image.getWidth() && h == image.getHeight())
         {
             // nothing to do
         }
         else
         {
             // allocate new framebuffer
             pixels = new int[w * h];
             image  = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
             // prepare frame
             if (frame == null)
             {
                 setPreferredSize(new Dimension(w, h));
                 frame = new JFrame("Sunflow v" + SunflowAPI.VERSION);
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//fixme: change to WinForms
                 //frame.addKeyListener(new KeyAdapter() {
                 //    @Override
                 //    public void keyPressed(KeyEvent e) {
                 //        if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
                 //            System.exit(0);
                 //    }
                 //});
                 frame.setContentPane(this);
                 frame.pack();
                 frame.setLocationRelativeTo(null);
                 frame.setVisible(true);
             }
         }
         // start counter
         t.start();
     }
 }
Пример #23
0
 public void imageBegin(int w, int h, int bucketSize)
 {
     lock (lockObj)
     {
         if (frame != null && image != null && w == image.getWidth() && h == image.getHeight())
         {
             // nothing to do
         }
         else
         {
             // allocate new framebuffer
             pixels = new int[w * h];
             image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
             // prepare frame
             if (frame == null)
             {
                 setPreferredSize(new Dimension(w, h));
                 frame = new JFrame("Sunflow v" + SunflowAPI.VERSION);
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//fixme: change to WinForms
                 //frame.addKeyListener(new KeyAdapter() {
                 //    @Override
                 //    public void keyPressed(KeyEvent e) {
                 //        if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
                 //            System.exit(0);
                 //    }
                 //});
                 frame.setContentPane(this);
                 frame.pack();
                 frame.setLocationRelativeTo(null);
                 frame.setVisible(true);
             }
         }
         // start counter
         t.start();
     }
 }
Пример #24
0
 public void setMainFrame(JFrame frame)
 {
     this.mainFrame = frame;
 }
Пример #25
0
 /// <summary>
 /// Construct a StateCU_DataSet_JFrame and optionally set visible. </summary>
 /// <param name="parent"> JFrame from which this instance is constructed. </param>
 /// <param name="dataset"> StateCU_DataSet that is being displayed/managed. </param>
 /// <param name="title"> Title to be displayed. </param>
 /// <param name="is_visible"> Indicates whether the display should be made visible at
 /// creation. </param>
 public StateCU_DataSet_JFrame(JFrame parent, StateCU_DataSet dataset, string title, bool is_visible)
 {
     __dataset = dataset;
     initialize(title, is_visible);
 }
        public CostOSRibbonApplicationMenuPopupPanel(JRibbonApplicationMenuButton paramJRibbonApplicationMenuButton, RibbonApplicationMenu paramRibbonApplicationMenu)
        {
            Layout = new BorderLayout();
            Border = BorderFactory.createEmptyBorder();
            if (paramRibbonApplicationMenu.DefaultCallback == null)
            {
                this.defaultPrimaryCallback = new PrimaryRolloverCallbackAnonymousInnerClass(this);
            }
            else
            {
                this.defaultPrimaryCallback = paramRibbonApplicationMenu.DefaultCallback;
            }
            CostOSApplicationMenuContainerPanel costOSApplicationMenuContainerPanel = new CostOSApplicationMenuContainerPanel(new BorderLayout());

            costOSApplicationMenuContainerPanel.Background = SECONDARY_MENU_COLOR;
            JFrame jFrame = CostOSRootPaneUI.Resolver.MainFrame;

            costOSApplicationMenuContainerPanel.MinimumSize   = new Dimension(jFrame.Width - 2, jFrame.Height - 55);
            costOSApplicationMenuContainerPanel.PreferredSize = new Dimension(jFrame.Width - 2, jFrame.Height - 55);
            costOSApplicationMenuContainerPanel.MaximumSize   = new Dimension(jFrame.Width - 2, jFrame.Height - 55);
            this.panelLevel1            = new JPanel();
            this.panelLevel1.Layout     = new LayoutManagerAnonymousInnerClass(this);
            this.panelLevel1.Background = PRIMARY_MENU_COLOR;
            this.panelLevel1.Border     = BorderFactory.createEmptyBorder();
            if (paramRibbonApplicationMenu != null)
            {
                System.Collections.IList list = paramRibbonApplicationMenu.PrimaryEntries;
                if (list != null && list.Count > 0)
                {
                    EmptyResizableIcon emptyResizableIcon = new EmptyResizableIcon(16);
                    for (sbyte b = 0; b < list.Count; b++)
                    {
                        System.Collections.IList list1 = (System.Collections.IList)list[b];
                        foreach (RibbonApplicationMenuEntryPrimary ribbonApplicationMenuEntryPrimary in list1)
                        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final JCommandAppMenuButton commandButton = new JCommandAppMenuButton(ribbonApplicationMenuEntryPrimary.getText(), emptyResizableIcon);
                            JCommandAppMenuButton commandButton = new JCommandAppMenuButton(ribbonApplicationMenuEntryPrimary.Text, emptyResizableIcon);
                            jCommandAppMenuButton.CommandButtonKind = ribbonApplicationMenuEntryPrimary.EntryKind;
                            jCommandAppMenuButton.addActionListener(ribbonApplicationMenuEntryPrimary.MainActionListener);
                            if (ribbonApplicationMenuEntryPrimary.RolloverCallback != null)
                            {
                                jCommandAppMenuButton.addRolloverActionListener(new RolloverActionListenerAnonymousInnerClass(this));
                            }
                            else if (ribbonApplicationMenuEntryPrimary.SecondaryGroupCount == 0)
                            {
                                jCommandAppMenuButton.addRolloverActionListener(new RolloverActionListenerAnonymousInnerClass2(this));
                            }
                            else
                            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback coreCallback = new org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback()
                                RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback coreCallback = new PrimaryRolloverCallbackAnonymousInnerClass2(this, commandButton);
                                jCommandAppMenuButton.addRolloverActionListener(new RolloverActionListenerAnonymousInnerClass3(this, commandButton, coreCallback));
                            }
                            jCommandAppMenuButton.DisplayState         = MENU_TILE_LEVEL_1;
                            jCommandAppMenuButton.HorizontalAlignment  = 10;
                            jCommandAppMenuButton.PopupOrientationKind = JCommandButton.CommandButtonPopupOrientationKind.SIDEWARD;
                            jCommandAppMenuButton.Enabled    = ribbonApplicationMenuEntryPrimary.Enabled;
                            jCommandAppMenuButton.Foreground = CostOSWindowsLookAndFeel.ribbonAppMenuButtonForegroundColor;
                            this.panelLevel1.add(jCommandAppMenuButton);
                        }
                        if (b < list.Count - 1)
                        {
                            JPopupMenu.Separator separator = new SeparatorAnonymousInnerClass(this);
                            this.panelLevel1.add(separator);
                        }
                    }
                }
            }
            costOSApplicationMenuContainerPanel.add(this.panelLevel1, "West");
            this.panelLevel2               = new JPanel();
            this.panelLevel2.Background    = SECONDARY_MENU_COLOR;
            this.panelLevel2.Border        = new BorderAnonymousInnerClass(this);
            this.panelLevel2.PreferredSize = new Dimension(30 * FlamingoUtilities.getFont(this.panelLevel1, new string[] { "Ribbon.font", "Button.font", "Panel.font" }).Size - 30, 10);
            this.defaultPrimaryCallback.menuEntryActivated(this.panelLevel2);
            costOSApplicationMenuContainerPanel.add(this.panelLevel2, "Center");
            add(costOSApplicationMenuContainerPanel, "Center");
            this.panelLevel1.doLayout();
            firstLevelMenuWidth = (int)this.panelLevel1.PreferredSize.Width;
        }
Пример #27
0
        private static void createMenuBar(JFrame jframe)
        {
            JMenuBar jmenuBar = new JMenuBar();

            jframe.setJMenuBar(jmenuBar);
            JMenu jmenu = new JMenu("File");

            jmenuBar.add(jmenu);
            JMenuItem jmenuItem = new JMenuItem("Open...");

            jmenuItem.setAccelerator(KeyStroke.getKeyStroke("control O"));
            jmenuItem.addActionListener(new AudioTool_1());
            jmenu.add(jmenuItem);
            AudioTool.saveMenuItem = new JMenuItem("Save");
            AudioTool.saveMenuItem.setAccelerator(KeyStroke.getKeyStroke("control S"));
            AudioTool.saveMenuItem.setEnabled(false);
            AudioTool.saveMenuItem.addActionListener(new AudioTool_2());
            jmenu.add(AudioTool.saveMenuItem);
            jmenuItem = new JMenuItem("Save As...");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke("control V"));
            jmenuItem.addActionListener(new AudioTool_3());
            jmenu.add(jmenuItem);
            jmenuItem = new JMenuItem("Quit");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke("control Q"));
            jmenuItem.addActionListener(new AudioTool_4());
            jmenu.add(jmenuItem);
            jmenu = new JMenu("Edit");
            jmenuBar.add(jmenu);
            jmenuItem = new JMenuItem("Select All");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke("control A"));
            jmenuItem.addActionListener(new AudioTool_5());
            jmenu.add(jmenuItem);
            jmenuItem = new JMenuItem("Crop");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke("control X"));
            jmenuItem.addActionListener(new AudioTool_6());
            jmenu.add(jmenuItem);
            jmenu = new JMenu("View");
            jmenuBar.add(jmenu);
            jmenuItem = new JMenuItem("Zoom In");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke('>'));
            jmenuItem.addActionListener(new AudioTool_7());
            jmenu.add(jmenuItem);
            jmenuItem = new JMenuItem("Zoom Out");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke('<'));
            jmenuItem.addActionListener(new AudioTool_8());
            jmenu.add(jmenuItem);
            jmenuItem = new JMenuItem("Original Size");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke('!'));
            jmenuItem.addActionListener(new AudioTool_9());
            jmenu.add(jmenuItem);
            jmenu = new JMenu("Audio");
            jmenuBar.add(jmenu);
            jmenuItem = new JMenuItem("Play");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke("control P"));
            jmenuItem.addActionListener(new AudioTool_10());
            jmenu.add(jmenuItem);
            AudioTool.recordListener = new AudioTool_11();
            jmenuItem = new JMenuItem("Record Start/Stop");
            jmenuItem.setAccelerator(KeyStroke.getKeyStroke("control R"));
            jmenuItem.addActionListener(AudioTool.recordListener);
            jmenu.add(jmenuItem);
        }
Пример #28
0
 public static void main(string[] args)
 {
     AudioTool.prefs    = Preferences.userRoot().node("/edu/cmu/sphinx/tools/audio/AudioTool");
     AudioTool.filename = AudioTool.prefs.get("filename", "untitled.raw");
     AudioTool.file     = new File(AudioTool.filename);
     if (args.Length == 1 && String.instancehelper_equals(args[0], "-dumpMixers"))
     {
         AudioTool.dumpMixers();
         java.lang.System.exit(0);
     }
     try
     {
         if (args.Length > 0)
         {
             AudioTool.filename = args[0];
         }
         URL url;
         if (args.Length == 2)
         {
             url = new File(args[1]).toURI().toURL();
         }
         else
         {
             url = ClassLiteral <AudioTool> .Value.getResource("spectrogram.config.xml");
         }
         ConfigurationManager configurationManager = new ConfigurationManager(url);
         AudioTool.recorder = (Microphone)configurationManager.lookup("microphone");
         AudioTool.recorder.initialize();
         AudioTool.audio = new AudioData();
         FrontEnd         frontEnd      = (FrontEnd)configurationManager.lookup("frontEnd");
         StreamDataSource dataSource    = (StreamDataSource)configurationManager.lookup("streamDataSource");
         FrontEnd         frontEnd2     = (FrontEnd)configurationManager.lookup("cepstrumFrontEnd");
         StreamDataSource dataSource2   = (StreamDataSource)configurationManager.lookup("cstreamDataSource");
         PropertySheet    propertySheet = configurationManager.getPropertySheet("windower");
         float            @float        = propertySheet.getFloat("windowShiftInMs");
         JFrame           jframe        = new JFrame("AudioTool");
         AudioTool.fileChooser = new JFileChooser();
         AudioTool.createMenuBar(jframe);
         float num = @float * AudioTool.audio.getAudioFormat().getSampleRate() / 1000f;
         AudioTool.audioPanel       = new AudioPanel(AudioTool.audio, 1f / num, 0.004f);
         AudioTool.spectrogramPanel = new SpectrogramPanel(frontEnd, dataSource, AudioTool.audio);
         AudioTool.cepstrumPanel    = new CepstrumPanel(frontEnd2, dataSource2, AudioTool.audio);
         JPanel jpanel = new JPanel();
         jpanel.setLayout(new BoxLayout(jpanel, 3));
         jpanel.add(AudioTool.audioPanel);
         AudioTool.audioPanel.setAlignmentX(0f);
         jpanel.add(AudioTool.spectrogramPanel);
         AudioTool.spectrogramPanel.setAlignmentX(0f);
         jpanel.add(AudioTool.cepstrumPanel);
         AudioTool.cepstrumPanel.setAlignmentX(0f);
         JScrollPane jscrollPane = new JScrollPane(jpanel);
         JPanel      jpanel2     = new JPanel(new BorderLayout());
         jpanel2.add(AudioTool.createButtonPanel(), "North");
         jpanel2.add(jscrollPane);
         AudioTool.player = new AudioPlayer(AudioTool.audio);
         AudioTool.player.start();
         AudioTool.getAudioFromFile(AudioTool.filename);
         jframe.setDefaultCloseOperation(3);
         jframe.setContentPane(jpanel2);
         jframe.pack();
         jframe.setSize(640, 400);
         jframe.setVisible(true);
     }
     catch (System.Exception ex)
     {
         Throwable.instancehelper_printStackTrace(ex);
     }
 }
 /// <summary>
 /// Constructor. </summary>
 /// <param name="parent"> the JFrame on which this appears. </param>
 public StateMod_NetworkReference_JComponent(JFrame parent) : base("StateMod_NetworkReference_JComponent")
 {
     addMouseListener(this);
     addMouseMotionListener(this);
 }