public CostOSRibbonApplicationMenuPopupPanelSecondary(RibbonApplicationMenuEntryPrimary paramRibbonApplicationMenuEntryPrimary) : base(MENU_TILE_LEVEL_2) { MaxButtonColumns = 1; Border = BorderFactory.createEmptyBorder(); int i = paramRibbonApplicationMenuEntryPrimary.SecondaryGroupCount; for (sbyte b = 0; b < i; b++) { string str = paramRibbonApplicationMenuEntryPrimary.getSecondaryGroupTitleAt(b); addButtonGroup(str); foreach (RibbonApplicationMenuEntrySecondary ribbonApplicationMenuEntrySecondary in paramRibbonApplicationMenuEntryPrimary.getSecondaryGroupEntries(b)) { JCommandMenuButton jCommandMenuButton = new JCommandMenuButton(ribbonApplicationMenuEntrySecondary.Text, ribbonApplicationMenuEntrySecondary.Icon); jCommandMenuButton.ExtraText = ribbonApplicationMenuEntrySecondary.DescriptionText; jCommandMenuButton.CommandButtonKind = ribbonApplicationMenuEntrySecondary.EntryKind; jCommandMenuButton.addActionListener(ribbonApplicationMenuEntrySecondary.MainActionListener); jCommandMenuButton.DisplayState = MENU_TILE_LEVEL_2; jCommandMenuButton.HorizontalAlignment = 10; jCommandMenuButton.PopupOrientationKind = JCommandButton.CommandButtonPopupOrientationKind.SIDEWARD; jCommandMenuButton.Enabled = ribbonApplicationMenuEntrySecondary.Enabled; jCommandMenuButton.PopupCallback = ribbonApplicationMenuEntrySecondary.PopupCallback; jCommandMenuButton.ActionKeyTip = ribbonApplicationMenuEntrySecondary.ActionKeyTip; jCommandMenuButton.PopupKeyTip = ribbonApplicationMenuEntrySecondary.PopupKeyTip; if (ribbonApplicationMenuEntrySecondary.DisabledIcon != null) { jCommandMenuButton.DisabledIcon = ribbonApplicationMenuEntrySecondary.DisabledIcon; } addButtonToLastGroup(jCommandMenuButton); } } }
public OfficeBandHostPopupPanel(Component param1Component, Dimension param1Dimension) { Layout = new BorderLayout(); add(param1Component, "Center"); PreferredSize = param1Dimension; Size = param1Dimension; Border = BorderFactory.createEmptyBorder(); }
public void menuEntryActivated(JPanel param1JPanel) { param1JPanel.removeAll(); param1JPanel.Layout = new BorderLayout(); CostOSRibbonApplicationMenuPopupPanelSecondary costOSRibbonApplicationMenuPopupPanelSecondary = new CostOSRibbonApplicationMenuPopupPanelSecondaryAnonymousInnerClass(this, menuEntry); JScrollPane jScrollPane = new JScrollPane(costOSRibbonApplicationMenuPopupPanelSecondary, 20, 31); jScrollPane.Border = BorderFactory.createEmptyBorder(); jScrollPane.Viewport.Background = SECONDARY_MENU_COLOR; jScrollPane.Background = SECONDARY_MENU_COLOR; Dimension dimension = costOSRibbonApplicationMenuPopupPanelSecondary.PreferredSize; costOSRibbonApplicationMenuPopupPanelSecondary.PreferredSize = new Dimension((param1JPanel.PreferredSize).width - (jScrollPane.VerticalScrollBar.PreferredSize).width, dimension.height); param1JPanel.Background = SECONDARY_MENU_COLOR; param1JPanel.add(jScrollPane, "Center"); param1JPanel.revalidate(); }
public UILabelPanel(Icon paramIcon, string paramString, JComponent paramJComponent) : base(new BorderLayout()) { this.titleLabel = new JLabel(paramString, paramIcon, 10); this.eastLabel = new JLabel("", 4); this.titleLabel.Font = new Font("SansSerif", 1, 11); this.eastLabel.Font = new Font("SansSerif", 1, 11); this.eastLabel.Foreground = Color.BLACK; JPanel jPanel = buildHeader(this.titleLabel); this.o_topPanel.Border = BorderFactory.createEmptyBorder(); this.o_topPanel.add(jPanel, "North"); add(this.o_topPanel, "North"); if (paramJComponent != null) { Content = paramJComponent; } Selected = true; updateHeader(); }
protected internal virtual JPanel buildHeader(JLabel paramJLabel) { this.o_eastPanel = new JPanel(new BorderLayout()); this.gradientPanel = createGradientPanel(); paramJLabel.Opaque = false; this.eastLabel.Opaque = false; this.o_eastPanel.Opaque = false; this.o_eastPanel.add(this.eastLabel, "East"); this.hasEastTextComponent = true; this.gradientPanel.add(paramJLabel, "West"); this.gradientPanel.add(this.o_eastPanel, "East"); this.gradientPanel.Border = BorderFactory.createEmptyBorder(3, 4, 3, 1); this.headerPanel = new JPanel(new BorderLayout()); this.headerPanel.add(this.gradientPanel, "Center"); this.headerPanel.Border = new RaisedHeaderBorder(); this.headerPanel.Opaque = false; this.gradientPanel.setComponentZOrder(paramJLabel, 1); this.gradientPanel.setComponentZOrder(this.o_eastPanel, 0); return(this.headerPanel); }
private void loadUI() { JPanel jPanel = new JPanel(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.text.DecimalFormat decimalFormat = (java.text.DecimalFormat)java.text.DecimalFormat.getInstance(java.util.Locale.ENGLISH).clone(); DecimalFormat decimalFormat = (DecimalFormat)DecimalFormat.getInstance(Locale.ENGLISH).clone(); decimalFormat.applyPattern("0"); this.o_progressBar = new JProgressBar(0, this.o_totalTimes); this.o_progressBar.StringPainted = true; this.o_descriptionLabel = new JLabel(); this.o_progressBar.addChangeListener(new ChangeListenerAnonymousInnerClass(this, decimalFormat)); jPanel.Border = BorderFactory.createEmptyBorder(10, 0, 0, 0); jPanel.Layout = new BoxLayout(jPanel, 1); jPanel.add(this.o_descriptionLabel); jPanel.add(Box.createVerticalStrut(5)); jPanel.add(this.o_progressBar); jPanel.add(Box.createVerticalStrut(5)); this.o_mainPanel.Border = BorderFactory.createEmptyBorder(8, 8, 8, 8); this.o_mainPanel.add(jPanel, "Center"); }
public CostOSRibbonApplicationMenuPopupPanelDefault() : base(MENU_TILE_LEVEL_2) { MaxButtonColumns = 1; Border = BorderFactory.createEmptyBorder(); }
protected internal virtual object[] getColorSchemeBlueDefaults(UIDefaults paramUIDefaults) { ColorUIResource colorUIResource1 = new ColorUIResource(applicationBackground); ColorUIResource colorUIResource2 = new ColorUIResource(applicationBackground); return(new object[] { "OfficeLnF.name", "Office2013", "OfficeLnF.ComboBox.Arrow.Armed.Gradient1", new ColorUIResource(255, 244, 204), "OfficeLnF.ComboBox.Arrow.Armed.Gradient2", new ColorUIResource(255, 212, 151), "OfficeLnF.ComboBox.Arrow.Selected.Gradient1", new ColorUIResource(254, 145, 78), "OfficeLnF.ComboBox.Arrow.Selected.Gradient2", new ColorUIResource(255, 203, 135), "OfficeLnF.ComboBox.Arrow.Normal.Gradient1", new ColorUIResource(195, 218, 249), "OfficeLnF.ComboBox.Arrow.Normal.Gradient2", null, "Office2003LnF.CBMenuItemCheckBGColor", new ColorUIResource(255, 192, 111), "Office2003LnF.CBMenuItemCheckBGSelectedColor", new ColorUIResource(254, 128, 62), "OfficeLnF.HighlightBorderColor", new ColorUIResource(applicationBorderColor), "OfficeLnF.HighlightColor", new ColorUIResource(selectionColor), "Office2003LnF.ToolBarGripLightColor", new ColorUIResource(255, 255, 255), "Office2003LnF.ToolBarGripDarkColor", new ColorUIResource(applicationBorderColor), "Office2003LnF.MenuItemBeginGradientColor", new ColorUIResource(227, 239, 255), "Office2003LnF.MenuItemEndGradientColor", new ColorUIResource(135, 173, 228), "Office2003LnF.PanelGradientColor1", new ColorUIResource(158, 190, 245), "Office2003LnF.PanelGradientColor2", new ColorUIResource(195, 218, 249), "Office2003LnF.ToolBarBeginGradientColor", new ColorUIResource(applicationBackground), "Office2003LnF.ToolBarEndGradientColor", new ColorUIResource(applicationBackground), "Office2003LnF.ToolBarBottomBorderColor", new ColorUIResource(applicationBackground), "Office2003LnF.ToolBarBackgroundColor", new ColorUIResource(applicationBackground), "Office2003LnF.ToolBarButtonArmedBeginGradientColor", new ColorUIResource(selectionColor), "Office2003LnF.ToolBarButtonArmedEndGradientColor", new ColorUIResource(selectionColor), "Office2003LnF.ToolBarButtonSelectedBeginGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.ToolBarButtonSelectedEndGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.MenuBarItemArmedBeginGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.MenuBarItemArmedEndGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.MenuBarItemSelectedBeginGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.MenuBarItemSelectedEndGradientColor", new ColorUIResource(selectionDarkerColor), "OfficeLnF.MenuBorderColor", new ColorUIResource(0, 45, 150), "UILabelPanel.gradientBegin", new ColorUIResource(gradientBegin), "UILabelPanel.gradientEnd", new ColorUIResource(gradientEnd), "UILabelPanel.noGradientFill", new ColorUIResource(applicationBackground), "MenuItem.background", new ColorUIResource(applicationBackground), "checkBoxMenuItemBackground", colorUIResource2, "OptionPane.background", colorUIResource2, "menuBackground", colorUIResource2, "menuBarBackground", colorUIResource1, "menuItemBackground", colorUIResource2, "radioButtonMenuItemBackground", colorUIResource2, "toolBarShadow", new ColorUIResource(applicationBorderColor), "toolBarHighlight", new ColorUIResource(applicationBorderColor), "separatorForeground", new ColorUIResource(textForegroundColor), "separatorBackground", colorUIResource2, "Table.selectionBackground", new ColorUIResource(tableSelectBackground), "Table.selectionForeground", new ColorUIResource(tableSelectForeground), "Tree.selectionBackground", new ColorUIResource(tableSelectBackground), "Tree.selectionForeground", new ColorUIResource(tableSelectForeground), "List.selectionBackground", new ColorUIResource(tableSelectBackground), "List.selectionForeground", new ColorUIResource(tableSelectForeground), "ComboBox.selectionBackground", new ColorUIResource(tableSelectBackground), "ComboBox.selectionForeground", new ColorUIResource(tableSelectForeground), "RadioButton.background", new ColorUIResource(applicationBackground), "RadioButton.border", new ColorUIResource(applicationBackground), "RadioButton.darkShadow", new ColorUIResource(applicationBackground), "ToolBar.border", BorderFactory.createEmptyBorder(), "Separator.background", applicationBorderColor, "Separator.shadow", colorUIResource2, "Office2003LnF.CBMenuItemCheckBGColor", selectionColor, "SidePane.selectedButtonBackground", selectionDarkerColor, "JideButton.selectedBackground", selectionDarkerColor, "Gripper.foreground", ribbonBackground, "OptionPane.bannerLt", new ColorUIResource(applicationBackground), "OptionPane.bannerDk", new ColorUIResource(applicationBackground), "CollapsiblePane.background", new ColorUIResource(ribbonBackground), "CollapsiblePanes.backgroundLt", new ColorUIResource(ribbonBackground), "CollapsiblePanes.backgroundDk", new ColorUIResource(ribbonBackground), "CollapsiblePane.emphasizedBackground", applicationButtonSelectedColor, "CollapsiblePaneTitlePane.backgroundLt.emphasized", new ColorUIResource(applicationButtonSelectedColor), "CollapsiblePaneTitlePane.backgroundDk.emphasized", new ColorUIResource(applicationButtonSelectedColor), "CollapsiblePane.emphasizedForeground", Color.white, "CollapsiblePaneTitlePane.foreground.emphasized", new ColorUIResource(Color.white), "CollapsiblePaneTitlePane.foreground.focus.emphasized", new ColorUIResource(Color.white.brighter()), "TextField.inactiveBackground", applicationBackground, "CheckBox.background", applicationBackground, "ComboBox.buttonBackground", applicationBackground, "control", applicationBackground, "JideTabbedPane.tabAreaBackground", new ColorUIResource(selectionDarkerColor), "JideTabbedPane.selectedTabBackground", new ColorUIResource(selectionDarkerColor), "JideTabbedPane.selectedTabBackgroundDk", ColorUtils.getDerivedColor(selectionDarkerColor, 0.6F), "JideTabbedPane.selectedTabBackgroundDk", ColorUtils.getDerivedColor(selectionDarkerColor, 0.4F), "selection.border", selectionColor, "selection.RolloverLt", ColorUtils.getDerivedColor(selectionColor, 0.6F), "selection.RolloverDk", ColorUtils.getDerivedColor(selectionColor, 0.4F), "selection.SelectedLt", ColorUtils.getDerivedColor(selectionDarkerColor, 0.6F), "selection.SelectedDk", ColorUtils.getDerivedColor(selectionDarkerColor, 0.4F), "selection.PressedLt", ColorUtils.getDerivedColor(selectionDarkerColor, 0.4F), "selection.PressedDk", ColorUtils.getDerivedColor(selectionDarkerColor, 0.6F) }); }
public TaskbarPanel(CostOSRibbonUI outerInstance) { this.outerInstance = outerInstance; Opaque = false; Border = BorderFactory.createEmptyBorder(1, 0, 1, 0); }
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; }
//-------- //-------- Constructors //-------- /// <summary> /// Constructor a frame to contain the device data. Provide /// the device and the log file name /// </summary> public TagMainFrame() : base("1-Wire Tag Viewer") { // construct the frame //set the look and feel to the system look and feel try { UIManager.LookAndFeel = UIManager.SystemLookAndFeelClassName; } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } // add an event listener to end the aplication when the frame is closed addWindowListener(new WindowAdapterAnonymousInnerClassHelper(this, e)); // create the main panel mainPanel = new JPanel(new BorderLayout(10, 10)); // create the sub-pannels northPanel = new JPanel(); northPanel.Border = BorderFactory.createLoweredBevelBorder(); centerPanel = new JPanel(); centerPanel.Layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); southPanel = new JPanel(); southPanel.Layout = new BoxLayout(southPanel, BoxLayout.Y_AXIS); southPanel.Border = BorderFactory.createLoweredBevelBorder(); westPanel = new JPanel(); westPanel.Border = BorderFactory.createRaisedBevelBorder(); westPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); eastPanel = new JPanel(); eastPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); // fill the panels // north logLabel = new JLabel("Log Filename: "); northPanel.add(logLabel); logField = new JTextField("log.txt", 20); logField.addActionListener(this); northPanel.add(logField); // center listData = new DefaultListModel(); listData.addElement(" "); listData.addElement(" "); listData.addElement(" "); listData.addElement(" "); pathList = new JList(listData); pathList.VisibleRowCount = 5; scrollPanel = new JScrollPane(pathList); scrollPanel.Border = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "1-Wire Paths to Search"); centerPanel.add(scrollPanel); // west scanCheck = new JCheckBox("Scan 1-Wire Paths for XML Tags", false); scanCheck.addActionListener(this); westPanel.add(scanCheck); // south portLabel = new JLabel("Adapter:"); southPanel.add(portLabel); statusLabel = new JLabel("Status:"); southPanel.add(statusLabel); // add to main mainPanel.add(northPanel, BorderLayout.NORTH); mainPanel.add(centerPanel, BorderLayout.CENTER); mainPanel.add(southPanel, BorderLayout.SOUTH); mainPanel.add(eastPanel, BorderLayout.EAST); mainPanel.add(westPanel, BorderLayout.WEST); // add to frame ContentPane.add(mainPanel); // pack the frame pack(); // resize the window and put in random location Dimension current_sz = Size; Size = new Dimension(current_sz.width * 5 / 4, current_sz.height); Toolkit tool = Toolkit.DefaultToolkit; Dimension mx = tool.ScreenSize; Dimension sz = Size; Random rand = new Random(); setLocation((mx.width - sz.width) / 2, (mx.height - sz.height) / 2); // clear out the listbox data listData.removeAllElements(); // make visible Visible = true; }
//-------- //-------- Constructors //-------- /// <summary> /// Constructor a frame to contain the device data. Provide /// the device and the log file name /// </summary> public DeviceFrame(TaggedDevice dev, string logFile) : base(dev.DeviceContainer.AddressAsString) { // construct the frame // init pollDelay = 0; readButtonClick = false; num_format = NumberFormat.Instance; num_format.MaximumFractionDigits = 2; num_format.MinimumFractionDigits = 0; num_format.MinimumIntegerDigits = 2; num_format.GroupingUsed = false; lastReading = "none"; // get ref to the tagged device and log file this.dev = dev; this.logFile = logFile; // set the look and feel to the system look and feel try { UIManager.LookAndFeel = UIManager.SystemLookAndFeelClassName; } catch (Exception e) { Debug.WriteLine(e.ToString()); Debug.Write(e.StackTrace); } // add an event listener to end the aplication when the frame is closed addWindowListener(new WindowAdapterAnonymousInnerClassHelper(this, e)); // create the main panel mainPanel = new JPanel(new GridLayout(3, 1)); // create the sub-panels topPanel = new JPanel(); topPanel.Layout = new BoxLayout(topPanel, BoxLayout.Y_AXIS); topPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); centerPanel = new JPanel(); centerPanel.Layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); centerPanel.Background = Color.white; bottomPanel = new JPanel(); bottomPanel.Layout = new BoxLayout(bottomPanel, BoxLayout.Y_AXIS); bottomPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); // fill the panels // top clusterLabel = new JLabel("Cluster: " + dev.ClusterName); topPanel.add(clusterLabel); mainLabel = new JLabel(dev.Label); mainLabel.HorizontalAlignment = JLabel.CENTER; mainLabel.Font = new Font("SansSerif", Font.PLAIN, 20); topPanel.add(mainLabel); logCheck = new JCheckBox("Logging Enable", false); logCheck.addActionListener(this); topPanel.add(logCheck); // center timeLabel = new JLabel("Last Reading: none"); timeLabel.HorizontalAlignment = JLabel.CENTER; centerPanel.add(timeLabel); // bottom readButton = new JButton("Read Once"); readButton.AlignmentX = Component.LEFT_ALIGNMENT; readButton.addActionListener(this); bottomPanel.add(readButton); string[] selectionStrings = new string[] { "No Polling", "1 second", "30 seconds", "1 minute", "10 minutes", "1 hour" }; pollCombo = new JComboBox(selectionStrings); pollCombo.Editable = false; pollCombo.AlignmentX = Component.LEFT_ALIGNMENT; pollCombo.addActionListener(this); bottomPanel.add(pollCombo); pathLabel = new JLabel("Path: " + dev.OWPath.ToString()); pathLabel.AlignmentX = Component.LEFT_ALIGNMENT; bottomPanel.add(pathLabel); // add to main mainPanel.add(topPanel); mainPanel.add(centerPanel); mainPanel.add(bottomPanel); // add to frame ContentPane.add(mainPanel); // pack the frame pack(); // resize the window and put in random location Dimension current_sz = Size; Size = new Dimension(current_sz.width * 3 / 2, current_sz.height); Toolkit tool = Toolkit.DefaultToolkit; Dimension mx = tool.ScreenSize; Dimension sz = Size; Random rand = new Random(); setLocation(rand.Next((mx.width - sz.width) / 2), rand.Next((mx.height - sz.height) / 2)); // make visible Visible = true; }