/** Initialise dialog. */ public void initUI() { try { FontMetrics fontMetrics = getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()); int minimumHeight = fontMetrics.getHeight() * 8 + HEIGHT_DELTA; int minimumWidth = Math.max( fontMetrics.stringWidth( controller .getLocaliser() .getString("createNewReceivingAddressDialog.message")), fontMetrics.stringWidth( controller .getLocaliser() .getString( "createNewReceivingAddressSubmitAction.createdSuccessfullyShort", new Object[] {new Integer(100)}))) + WIDTH_DELTA; setMinimumSize(new Dimension(minimumWidth, minimumHeight)); positionDialogRelativeToParent(this, 0.5D, 0.47D); } catch (NullPointerException npe) { // FontSizer fail - probably headless in test - carry on. } createNewReceivingAddressPanel = new CreateNewReceivingAddressPanel(this.bitcoinController, receiveBitcoinPanel, this); setLayout(new BorderLayout()); add(createNewReceivingAddressPanel, BorderLayout.CENTER); }
private int setupColumnWidths() { // Column widths. String[] columnVariables = tickerTableModel.getColumnVariables(); int tickerWidth = HORIZONTAL_DELTA; if (tickerTableModel.getRowCount() > 1) { // There may be a scroll bar so give it some space. tickerWidth += SCROLLBAR_WIDTH; } int numberOfColumns = Math.min(table.getColumnCount(), columnVariables.length); for (int i = 0; i < numberOfColumns; i++) { // work out width int columnWidth; if (TickerTableModel.TICKER_COLUMN_CURRENCY.equals(columnVariables[i])) { columnWidth = PER_COLUMN_HORIZONTAL_DELTA + Math.max( Math.max( fontMetrics.stringWidth( controller .getLocaliser() .getString("tickerTableModel." + columnVariables[i])), fontMetrics.stringWidth((String) tickerTableModel.getValueAt(0, i))), fontMetrics.stringWidth((String) tickerTableModel.getValueAt(1, i))); } else if (TickerTableModel.TICKER_COLUMN_EXCHANGE.equals(columnVariables[i])) { columnWidth = PER_COLUMN_HORIZONTAL_DELTA + Math.max( Math.max( fontMetrics.stringWidth( controller .getLocaliser() .getString("tickerTableModel." + columnVariables[i])), fontMetrics.stringWidth((String) tickerTableModel.getValueAt(0, i))), fontMetrics.stringWidth((String) tickerTableModel.getValueAt(1, i))); } else { columnWidth = PER_COLUMN_HORIZONTAL_DELTA + Math.max( fontMetrics.stringWidth( controller .getLocaliser() .getString("tickerTableModel." + columnVariables[i])), fontMetrics.stringWidth("000000.00000")); } tickerWidth += columnWidth; table.getColumnModel().getColumn(i).setPreferredWidth(columnWidth); } return tickerWidth; }
private JPanel createButtonPanel() { JPanel buttonPanel = new JPanel(); buttonPanel.setOpaque(false); FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(FlowLayout.LEADING); buttonPanel.setLayout(flowLayout); buttonPanel.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); verifyMessageSubmitAction = new VerifyMessageSubmitAction( this.bitcoinController, mainFrame, this, ImageLoader.createImageIcon(ImageLoader.MESSAGE_VERIFY_ICON_FILE)); MultiBitButton submitButton = new MultiBitButton(verifyMessageSubmitAction, controller); submitButton.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); buttonPanel.add(submitButton); clearAllButton = new MultiBitButton(controller.getLocaliser().getString("signMessagePanel.clearAll.text")); clearAllButton.setToolTipText( controller.getLocaliser().getString("signMessagePanel.clearAll.tooltip")); clearAllButton.setIcon(ImageLoader.createImageIcon(ImageLoader.DELETE_ICON_FILE)); clearAllButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { addressTextArea.setText(""); messageTextArea.setText(""); signatureTextArea.setText(""); messageLabel1.setText(" "); messageLabel2.setText(" "); } }); clearAllButton.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); buttonPanel.add(clearAllButton); return buttonPanel; }
/** Creates a new {@link IssueAssetDialog}. */ public IssueAssetDialog( BitcoinController bitcoinController, MultiBitFrame mainFrame, TradeingPanel tradePanel) { super(mainFrame, bitcoinController.getLocaliser().getString("IssueAssetDialog.title")); this.bitcoinController = bitcoinController; this.controller = this.bitcoinController; this.tradePanel = tradePanel; initUI(); issueAssetPanel.getCancelButton().requestFocusInWindow(); applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); }
/** Creates a new {@link VerifyMessagePanel}. */ public VerifyMessagePanel(BitcoinController bitcoinController, MultiBitFrame mainFrame) { this.bitcoinController = bitcoinController; this.controller = this.bitcoinController; this.mainFrame = mainFrame; setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR); applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); initUI(); walletBusyChange(this.bitcoinController.getModel().getActivePerWalletModelData().isBusy()); this.bitcoinController.registerWalletBusyListener(this); }
/** Creates a new {@link CreateNewReceivingAddressDialog}. */ public CreateNewReceivingAddressDialog( BitcoinController bitcoinController, MultiBitFrame mainFrame, ReceiveBitcoinPanel receiveBitcoinPanel) { super( mainFrame, bitcoinController.getLocaliser().getString("createNewReceivingAddressDialog.title")); this.bitcoinController = bitcoinController; this.controller = this.bitcoinController; this.receiveBitcoinPanel = receiveBitcoinPanel; initUI(); createNewReceivingAddressPanel.getCancelButton().requestFocusInWindow(); applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); }
public TickerTablePanel(MultiBitFrame mainFrame, ExchangeController exchangeController) { this.exchangeController = exchangeController; this.controller = this.exchangeController; this.mainFrame = mainFrame; font = FontSizer.INSTANCE.getAdjustedDefaultFontWithDelta(-1); fontMetrics = getFontMetrics(font); // Switch the dark and light row highlighting for Windows. if (System.getProperty("os.name", "unknown").startsWith("Win")) { moduloRow = 1; } else { moduloRow = 0; } initUI(); applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); }
@Override public String getViewTooltip() { return controller.getLocaliser().getString("verifyMessageAction.tooltip"); }
@Override public String getViewTitle() { return controller.getLocaliser().getString("verifyMessageAction.text"); }
private JPanel createInstructionsPanel(int stentWidth) { MultiBitTitledPanel instructionsPanel = new MultiBitTitledPanel( controller.getLocaliser().getString("verifyMessagePanel.instructions.title"), ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); GridBagConstraints constraints = new GridBagConstraints(); MultiBitTitledPanel.addLeftJustifiedTextAtIndent( controller.getLocaliser().getString("verifyMessagePanel.instructions.text1"), 3, instructionsPanel); MultiBitTitledPanel.addLeftJustifiedTextAtIndent( controller.getLocaliser().getString("verifyMessagePanel.instructions.text2"), 4, instructionsPanel); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 1; constraints.gridy = 5; constraints.weightx = 0.3; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; instructionsPanel.add( MultiBitTitledPanel.createStent(stentWidth, ExportPrivateKeysPanel.STENT_HEIGHT), constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 6; constraints.weightx = 0.05; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.CENTER; instructionsPanel.add( MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS), constraints); JPanel filler3 = new JPanel(); filler3.setOpaque(false); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 1; constraints.gridy = 8; constraints.weightx = 0.3; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; instructionsPanel.add(filler3, constraints); addressLabel = new MultiBitLabel(controller.getLocaliser().getString("sendBitcoinPanel.addressLabel")); addressLabel.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 9; constraints.weightx = 0.3; constraints.weighty = 0.4; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; instructionsPanel.add(addressLabel, constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 9; constraints.weightx = 0.05; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.CENTER; instructionsPanel.add( MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS), constraints); // addressTextArea = new MultiBitTextField("", 30, controller); JTextField aTextField = new JTextField(); addressTextArea = new MultiBitTextArea("", 1, 30, controller); addressTextArea.setBorder(aTextField.getBorder()); addressTextArea.setMinimumSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT)); addressTextArea.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT)); addressTextArea.setMaximumSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT)); addressTextArea.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 3; constraints.gridy = 9; constraints.weightx = 0.3; constraints.weighty = 0.4; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; instructionsPanel.add(addressTextArea, constraints); JPanel filler4 = new JPanel(); filler4.setOpaque(false); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 1; constraints.gridy = 10; constraints.weightx = 0.3; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; instructionsPanel.add(filler4, constraints); JTextField secondTextField = new JTextField(); messageTextArea = new MultiBitTextArea( "", AbstractTradePanel.PREFERRED_NUMBER_OF_LABEL_ROWS + 1, 20, controller); messageTextArea.setBorder(secondTextField.getBorder()); messageTextArea.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); final JScrollPane messageScrollPane = new JScrollPane( messageTextArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); messageScrollPane.setOpaque(true); messageScrollPane.setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR); messageScrollPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); messageScrollPane .getViewport() .addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if (messageScrollPane.getVerticalScrollBar().isVisible()) { messageScrollPane.setBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY)); } else { messageScrollPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); } } }); messageScrollPane.setMinimumSize( new Dimension( FIELD_WIDTH, (AbstractTradePanel.PREFERRED_NUMBER_OF_LABEL_ROWS + 1) * FIELD_HEIGHT + 6)); messageScrollPane.setPreferredSize( new Dimension( FIELD_WIDTH, (AbstractTradePanel.PREFERRED_NUMBER_OF_LABEL_ROWS + 1) * FIELD_HEIGHT + 6)); messageScrollPane.getHorizontalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT); messageScrollPane.getVerticalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT); if (messageScrollPane.getVerticalScrollBar().isVisible()) { messageScrollPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY)); } else { messageScrollPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); } messageLabel = new MultiBitLabel(controller.getLocaliser().getString("verifyMessagePanel.message.text")); messageLabel.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 11; constraints.weightx = 0.3; constraints.weighty = 0.4; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; instructionsPanel.add(messageLabel, constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 11; constraints.weightx = 0.05; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.CENTER; instructionsPanel.add( MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 3; constraints.gridy = 11; constraints.weightx = 0.3; constraints.weighty = 0.4; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; instructionsPanel.add(messageScrollPane, constraints); JPanel filler5 = new JPanel(); filler5.setOpaque(false); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 1; constraints.gridy = 12; constraints.weightx = 0.3; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; instructionsPanel.add(filler5, constraints); signatureLabel = new MultiBitLabel(controller.getLocaliser().getString("verifyMessagePanel.signature.text")); signatureLabel.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 13; constraints.weightx = 0.3; constraints.weighty = 0.4; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; instructionsPanel.add(signatureLabel, constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 13; constraints.weightx = 0.05; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.CENTER; instructionsPanel.add( MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS), constraints); JTextField anotherTextField = new JTextField(); signatureTextArea = new MultiBitTextArea("", 2, 30, controller); signatureTextArea.setBorder(anotherTextField.getBorder()); signatureTextArea.setMinimumSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT * 2)); signatureTextArea.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT * 2)); signatureTextArea.setMaximumSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT * 2)); signatureTextArea.setLineWrap(true); signatureTextArea.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 3; constraints.gridy = 13; constraints.weightx = 0.3; constraints.weighty = 0.4; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; instructionsPanel.add(signatureTextArea, constraints); return instructionsPanel; }
private void initUI() { setLayout(new BorderLayout()); JPanel mainPanel = new JPanel(); mainPanel.setMinimumSize(new Dimension(800, 480)); mainPanel.setLayout(new GridBagLayout()); mainPanel.setOpaque(false); mainPanel.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); String[] keys = new String[] { "sendBitcoinPanel.addressLabel", "verifyMessagePanel.message.text", "verifyMessagePanel.signature.text" }; int stentWidth = MultiBitTitledPanel.calculateStentWidthForKeys(controller.getLocaliser(), keys, this) + ExportPrivateKeysPanel.STENT_DELTA; GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 2; constraints.weightx = 1; constraints.weighty = 1; constraints.anchor = GridBagConstraints.LINE_START; JPanel instructionsPanel = createInstructionsPanel(stentWidth); mainPanel.add(instructionsPanel, constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1; constraints.weighty = 0.1; constraints.anchor = GridBagConstraints.CENTER; mainPanel.add(MultiBitTitledPanel.createStent(12, 12), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 1; constraints.weightx = 0.4; constraints.weighty = 0.06; constraints.anchor = GridBagConstraints.LINE_START; JPanel buttonPanel = createButtonPanel(); mainPanel.add(buttonPanel, constraints); messageLabel1 = new MultiBitLabel(" "); messageLabel1.setOpaque(false); messageLabel1.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); messageLabel1.setHorizontalAlignment(JLabel.LEADING); messageLabel1.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 3; constraints.weightx = 1; constraints.weighty = 0.06; constraints.anchor = GridBagConstraints.LINE_START; mainPanel.add(messageLabel1, constraints); messageLabel2 = new MultiBitLabel(" "); messageLabel2.setOpaque(false); messageLabel2.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); messageLabel2.setHorizontalAlignment(JLabel.LEADING); messageLabel2.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 3; constraints.weightx = 1; constraints.weighty = 0.06; constraints.anchor = GridBagConstraints.LINE_START; mainPanel.add(messageLabel2, constraints); Action helpAction; if (ComponentOrientation.LEFT_TO_RIGHT == ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())) { helpAction = new HelpContextAction( controller, ImageLoader.HELP_CONTENTS_BIG_ICON_FILE, "multiBitFrame.helpMenuText", "multiBitFrame.helpMenuTooltip", "multiBitFrame.helpMenuText", HelpContentsPanel.HELP_SIGN_AND_VERIFY_MESSAGE_URL); } else { helpAction = new HelpContextAction( controller, ImageLoader.HELP_CONTENTS_BIG_RTL_ICON_FILE, "multiBitFrame.helpMenuText", "multiBitFrame.helpMenuTooltip", "multiBitFrame.helpMenuText", HelpContentsPanel.HELP_SIGN_AND_VERIFY_MESSAGE_URL); } HelpButton helpButton = new HelpButton(helpAction, controller); helpButton.setText(""); String tooltipText = HelpContentsPanel.createMultilineTooltipText( new String[] {controller.getLocaliser().getString("multiBitFrame.helpMenuTooltip")}); helpButton.setToolTipText(tooltipText); helpButton.setHorizontalAlignment(SwingConstants.LEADING); helpButton.setBorder( BorderFactory.createEmptyBorder( 0, AbstractTradePanel.HELP_BUTTON_INDENT, AbstractTradePanel.HELP_BUTTON_INDENT, AbstractTradePanel.HELP_BUTTON_INDENT)); helpButton.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 5; constraints.weightx = 1; constraints.weighty = 0.1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.BASELINE_LEADING; mainPanel.add(helpButton, constraints); JLabel filler2 = new JLabel(); filler2.setOpaque(false); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0; constraints.gridy = 6; constraints.gridwidth = 1; constraints.weightx = 1; constraints.weighty = 100; constraints.anchor = GridBagConstraints.CENTER; mainPanel.add(filler2, constraints); JScrollPane mainScrollPane = new JScrollPane( mainPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); mainScrollPane.setBorder(BorderFactory.createEmptyBorder()); mainScrollPane.getViewport().setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR); mainScrollPane.getViewport().setOpaque(true); mainScrollPane.applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); mainScrollPane.getHorizontalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT); mainScrollPane.getVerticalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT); add(mainScrollPane, BorderLayout.CENTER); }
private void createTicker() { setBackground(ColorAndFontConstants.BACKGROUND_COLOR); setLayout(new GridBagLayout()); setOpaque(false); setFocusable(false); setToolTipText( HelpContentsPanel.createMultilineTooltipText( new String[] { controller.getLocaliser().getString("tickerTablePanel.tooltip"), "\n ", controller.getLocaliser().getString("tickerTablePanel.tooltip.clickToConfigure") })); // on mouse click - view the exchanges tab MouseListener viewPreferencesMouseListener = new MouseAdapter() { @Override public void mouseReleased(MouseEvent arg0) { controller.displayView(View.PREFERENCES_VIEW); } }; String tickerTooltipText = HelpContentsPanel.createMultilineTooltipText( new String[] { controller.getLocaliser().getString("tickerTablePanel.tooltip"), "\n ", controller.getLocaliser().getString("tickerTablePanel.tooltip.clickToConfigure") }); addMouseListener(viewPreferencesMouseListener); GridBagConstraints constraints = new GridBagConstraints(); tickerTableModel = new TickerTableModel(this.exchangeController); table = new JTable(tickerTableModel); table.setOpaque(true); table.setShowGrid(true); table.setGridColor(Color.lightGray); table.setBackground(ColorAndFontConstants.BACKGROUND_COLOR); table.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, SystemColor.windowBorder)); table.setComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); table.setRowHeight(getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()).getHeight()); table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); table.getTableHeader().setReorderingAllowed(false); table.setToolTipText(tickerTooltipText); table.addMouseListener(viewPreferencesMouseListener); table.getTableHeader().addMouseListener(viewPreferencesMouseListener); table.getTableHeader().setToolTipText(tickerTooltipText); table.getTableHeader().setFont(FontSizer.INSTANCE.getAdjustedDefaultFontWithDelta(-1)); int tableHeaderHeight = fontMetrics.getHeight() + table.getTableHeader().getInsets().top + table.getTableHeader().getInsets().bottom; // Windows 8 has slightly taller headers so add a tweak for that. if (System.getProperty("os.name", "unknown").startsWith("Win")) { tableHeaderHeight = tableHeaderHeight + WINDOWS_TABLE_HEADER_HEIGHT_TWEAK; } int tickerWidth = setupColumnWidths(); setupTableHeaders(); idealHeight = (fontMetrics.getHeight() + table.getRowMargin()) * tickerTableModel.getRowCount() + tableHeaderHeight + tickerTableModel.getRowCount() + 10; setPreferredSize(new Dimension(tickerWidth, idealHeight)); scrollPane = new JScrollPane( table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); scrollPane.setBorder(BorderFactory.createEmptyBorder()); scrollPane.setViewportBorder(BorderFactory.createEmptyBorder()); scrollPane.addMouseListener(viewPreferencesMouseListener); setupScrollPane(tickerWidth); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 1; constraints.weightx = 1; constraints.weighty = 1; constraints.anchor = GridBagConstraints.CENTER; add(scrollPane, constraints); }
/** Creates a new {@link HelpAboutPanel}. */ public HelpAboutPanel(Controller controller, MultiBitFrame mainFrame) { setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR); this.controller = controller; String versionNumber = controller.getLocaliser().getVersionNumber(); String versionText = controller .getLocaliser() .getString("helpAboutAction.versionText", new Object[] {versionNumber}); GridBagConstraints constraints = new GridBagConstraints(); setLayout(new GridBagLayout()); ImageIcon imageIcon = ImageLoader.createImageIcon(SPLASH_ICON_FILE); JLabel splashLabel = new JLabel(); splashLabel.setIcon(imageIcon); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 1; constraints.weightx = 1; constraints.weighty = 0.4; constraints.anchor = GridBagConstraints.CENTER; add(splashLabel, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 1; constraints.weightx = 1; constraints.weighty = 0.1; constraints.anchor = GridBagConstraints.CENTER; JPanel fillerPanel1 = new JPanel(); fillerPanel1.setOpaque(false); add(fillerPanel1, constraints); MultiBitLabel titleLabel = new MultiBitLabel(""); titleLabel.setHorizontalTextPosition(JLabel.CENTER); titleLabel.setText(controller.getLocaliser().getString("helpAboutAction.messageBoxTitle")); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 1; constraints.weightx = 1; constraints.weighty = 0.1; constraints.anchor = GridBagConstraints.CENTER; add(titleLabel, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 1; constraints.weightx = 1; constraints.weighty = 0.1; constraints.anchor = GridBagConstraints.CENTER; MultiBitLabel urlLabel = new MultiBitLabel(MULTIBIT_URL); add(urlLabel, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 1; constraints.weightx = 1; constraints.weighty = 0.1; constraints.anchor = GridBagConstraints.CENTER; MultiBitLabel versionLabel = new MultiBitLabel(versionText); add(versionLabel, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 5; constraints.gridwidth = 1; constraints.weightx = 1; constraints.weighty = 0.2; constraints.anchor = GridBagConstraints.CENTER; JPanel fillerPanel2 = new JPanel(); fillerPanel2.setOpaque(false); add(fillerPanel2, constraints); applyComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); }
@Override public String getViewTooltip() { return controller.getLocaliser().getString("helpAboutAction.tooltip"); }