List of usage examples for java.awt GridBagConstraints NORTHWEST
int NORTHWEST
To view the source code for java.awt GridBagConstraints NORTHWEST.
Click Source Link
From source file:Main.java
public static GridBagConstraints defaultConstraints() { GridBagConstraints constraints = new GridBagConstraints(); constraints.anchor = GridBagConstraints.WEST; constraints.gridx = 0;// w ww .ja v a 2 s. c o m constraints.gridy = 0; constraints.ipadx = 3; constraints.ipady = 2; constraints.weightx = 1; // constraints.weighty = 1; constraints.anchor = GridBagConstraints.NORTHWEST; constraints.fill = GridBagConstraints.BOTH; return constraints; }
From source file:Main.java
public Main() { getContentPane().setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); JPanel panel1 = new JPanel(); Border eBorder = BorderFactory.createEtchedBorder(); panel1.setBorder(BorderFactory.createTitledBorder(eBorder, "70pct")); gbc.gridx = gbc.gridy = 0;// w w w .j av a 2 s. c o m gbc.gridwidth = gbc.gridheight = 1; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = gbc.weighty = 70; getContentPane().add(panel1, gbc); JPanel panel2 = new JPanel(); panel2.setBorder(BorderFactory.createTitledBorder(eBorder, "30pct")); gbc.gridy = 1; gbc.weightx = 30; gbc.weighty = 30; gbc.insets = new Insets(2, 2, 2, 2); getContentPane().add(panel2, gbc); pack(); }
From source file:Main.java
public Main() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); JPanel panel1 = new JPanel(); Border eBorder = BorderFactory.createEtchedBorder(); panel1.setBorder(BorderFactory.createTitledBorder(eBorder, "70pct")); gbc.gridx = gbc.gridy = 0;/*from ww w . ja va 2 s. c o m*/ gbc.gridwidth = gbc.gridheight = 1; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = gbc.weighty = 70; add(panel1, gbc); JPanel panel2 = new JPanel(); panel2.setBorder(BorderFactory.createTitledBorder(eBorder, "30pct")); gbc.gridy = 1; gbc.weightx = gbc.weighty = 30; gbc.insets = new Insets(2, 2, 2, 2); add(panel2, gbc); JPanel panel3 = new JPanel(); panel3.setBorder(BorderFactory.createTitledBorder(eBorder, "20pct")); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 2; gbc.weightx = 20; gbc.insets = new Insets(2, 2, 2, 2); add(panel3, gbc); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); }
From source file:org.pentaho.ui.xul.swing.tags.SwingGrid.java
@Override public void resetContainer() { grid.removeAll();//from ww w .ja va 2 s.co m gc = new GridBagConstraints(); gc.gridy = 0; gc.gridx = 0; gc.gridheight = 1; gc.gridwidth = 1; gc.insets = new Insets(2, 2, 2, 2); gc.anchor = GridBagConstraints.NORTHWEST; gc.weightx = 1; }
From source file:org.pentaho.ui.xul.swing.tags.SwingGroupbox.java
public void resetContainer() { container.removeAll();//from w ww. j a v a2 s . c om if (this.getOrientation() == Orient.VERTICAL) { gc = new GridBagConstraints(); gc.gridy = GridBagConstraints.RELATIVE; gc.gridx = 0; gc.gridheight = 1; gc.gridwidth = GridBagConstraints.REMAINDER; int pad = getPadding(); gc.insets = new Insets(pad, pad, pad, pad); gc.fill = GridBagConstraints.HORIZONTAL; gc.anchor = GridBagConstraints.NORTHWEST; gc.weightx = 1; } else { gc = new GridBagConstraints(); gc.gridy = 0; gc.gridx = GridBagConstraints.RELATIVE; gc.gridheight = GridBagConstraints.REMAINDER; gc.gridwidth = 1; gc.insets = new Insets(2, 2, 2, 2); gc.fill = GridBagConstraints.VERTICAL; gc.anchor = GridBagConstraints.NORTHWEST; gc.weighty = 1; } }
From source file:savant.settings.Section.java
public GridBagConstraints getFullRowConstraints() { return new GridBagConstraints(0, GridBagConstraints.RELATIVE, GridBagConstraints.REMAINDER, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(3, 3, 3, 3), 0, 0); }
From source file:org.pentaho.ui.xul.swing.tags.SwingHbox.java
public void resetContainer() { container.removeAll();/*from ww w . j a v a2 s .c o m*/ gc = new GridBagConstraints(); gc.gridx = GridBagConstraints.RELATIVE; gc.gridy = 0; gc.gridheight = GridBagConstraints.REMAINDER; gc.gridwidth = 1; int pad = getPadding(); gc.insets = new Insets(pad, pad, pad, pad); gc.fill = GridBagConstraints.HORIZONTAL; gc.anchor = GridBagConstraints.NORTHWEST; gc.weighty = 1; }
From source file:org.openconcerto.erp.core.finance.accounting.ui.AjouterComptePCGtoPCEFrame.java
public AjouterComptePCGtoPCEFrame() { super("Ajouter un compte du plan comptable gnral"); Container f = this.getContentPane(); // instanciation du panel et du menu click droit associ Vector<AbstractAction> actionClickDroitTable = new Vector<AbstractAction>(); actionClickDroitTable.add(new AbstractAction("Ajouter au PCE") { public void actionPerformed(ActionEvent e) { ajoutCompteSelected();//from w w w . ja v a 2 s . com } }); this.planPanel = new PlanComptableGPanel(actionClickDroitTable); this.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(12, 2, 12, 2); c.gridx = 0; c.gridy = 0; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTHWEST; c.gridwidth = 2; c.gridheight = 1; JLabel label = new JLabel("Choississez le ou les comptes ajouter au Plan Comptable Entreprise"); label.setHorizontalAlignment(SwingConstants.CENTER); f.add(label, c); /******************************************************************************************* * * Affichage du plan comptable entreprise ******************************************************************************************/ c.insets = new Insets(0, 0, 0, 0); c.gridwidth = 2; c.gridheight = 1; c.weightx = 1; c.weighty = 1; c.gridy++; f.add(this.planPanel, c); /******************************************************************************************* * * Bouton ajout / fermer ******************************************************************************************/ c.insets = new Insets(2, 2, 1, 2); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; c.gridy++; c.gridx = 0; c.anchor = GridBagConstraints.SOUTHEAST; f.add(this.boutonAjout, c); this.boutonAjout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ajoutCompteSelected(); } }); c.gridx++; f.add(this.boutonClose, c); this.boutonClose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AjouterComptePCGtoPCEFrame.this.setVisible(false); AjouterComptePCGtoPCEFrame.this.dispose(); } }); /* * this.pack(); this.setVisible(true); */ }
From source file:de.fhbingen.wbs.wpOverview.tabs.AvailabilityGraphGUI.java
/** * Load the GUI./*from w ww . j a va 2s. c o m*/ */ protected final void initGUI() { this.setLayout(new BorderLayout()); this.add(createOptionPanel(), BorderLayout.NORTH); pnlGraph = new ChartPanel(null); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1; constraints.weighty = 1; constraints.anchor = GridBagConstraints.NORTHWEST; panel.add(pnlGraph, constraints); panel.setBackground(Color.white); this.add(panel, BorderLayout.CENTER); }
From source file:com.std.StockPanel.java
public void setHistoricalData() { this.setLayout(new BorderLayout()); nameAndChangePanel.setLayout(new BoxLayout(nameAndChangePanel, BoxLayout.PAGE_AXIS)); nameAndChangePanel.add(nameLbl);//from w w w.ja v a2 s .c o m nameAndChangePanel.add(priceChangePercentLbl); data = new Object[30][2]; String[] colnames = { "1", "2" }; GridBagConstraints c = new GridBagConstraints(); dataAndGraph.setLayout(new GridBagLayout()); c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 0; c.gridheight = 1; c.insets = new Insets(0, 20, 0, 20); dataAndGraph.add(nameAndChangePanel, c); c.weightx = 0; c.weighty = 1; c.insets = new Insets(0, 20, 0, 0); //c.ipady = 20; c.gridx = 0; c.gridy = 1; remainingInfoTable = new StockTable(data, colnames); remainingInfoTable.setShowGrid(false); remainingInfoTable.setTableHeader(null); remainingInfoTable.setBackground(this.getBackground()); remainingInfoTable.setFocusable(false); remainingInfoTable.setColumnSelectionAllowed(false); remainingInfoTable.setRowSelectionAllowed(false); remainingInfoTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); dataAndGraph.add(remainingInfoTable, c); this.add(dataAndGraph, BorderLayout.CENTER); c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 0; c.gridheight = 2; //c.ipady = 20; c.gridx = 1; c.gridy = 0; dataAndGraph.add(chartPane, c); chartPane.setVisible(false); this.add(dataAndGraph, BorderLayout.CENTER); Test.show_hist_data(currentStock, b); currentStock.calculate_beta(sp500, 1200); nameLbl.setText(currentStock.get_name() + " (" + currentStock.get_symbol() + ")"); nameLbl.setFont(new Font(nameLbl.getName(), Font.BOLD, 24)); priceChangePercentLbl.setText(currentStock.get_price() + " "); String message = currentStock.get_change() + " " + currentStock.get_percent_change(); if (Double.parseDouble(currentStock.get_change()) < 0) priceChangePercentLbl.setText(String.format("<html>%s<font color='red'>%s</font></html>", priceChangePercentLbl.getText(), message)); else priceChangePercentLbl.setText(String.format("<html>%s<font color='green'>%s</font></html>", priceChangePercentLbl.getText(), message)); priceChangePercentLbl.setFont(new Font(priceChangePercentLbl.getName(), Font.PLAIN, 15)); data[0][0] = "Prev Close: " + currentStock.get_prev_close(); data[1][0] = "Open: " + currentStock.get_open_price(); data[2][0] = "Bid: " + currentStock.get_bid(); data[3][0] = "Ask: " + currentStock.get_ask(); data[4][0] = "One Year Target: " + currentStock.get_one_year_target(); data[5][0] = "Ebita: " + currentStock.get_ebitda(); data[0][1] = "Day Range: " + currentStock.get_days_range(); data[1][1] = "52 Week Range: " + currentStock.get_year_range(); data[2][1] = "Volume: " + currentStock.get_volume(); data[3][1] = "Average Daily Volume: " + currentStock.get_avg_daily_volume(); data[4][1] = "Market Cap: " + currentStock.get_market_cap(); data[5][1] = "P/E: " + currentStock.get_pe(); data[6][1] = "EPS: " + currentStock.get_earnings_per_share(); data[7][1] = "Dividend (Yield): " + currentStock.get_dividend_per_share() + "(" + currentStock.get_dividend_yield() + ")"; data[6][0] = "Reveune:" + currentStock.get_revenue(); data[7][0] = "Earnings Estimate: " + currentStock.get_earnings_estimate_current_year(); data[8][0] = "Beta: " + currentStock.get_beta(); data[8][1] = "PEG Ratio: " + currentStock.get_peg_ratio(); data[9][0] = "Short Ratio: " + currentStock.get_short_ratio(); data[11][0] = "50 Day MA: " + currentStock.get_fiftyday_moving_avg(); data[12][0] = "200 Day MA: " + currentStock.get_twohundredday_moving_avg(); if (currentStock.get_change_from_fiftyday_moving_avg() != null && currentStock.get_change_from_fiftyday_moving_avg().contains("-")) { data[13][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Change 50 Day MA: ", currentStock.get_change_from_fiftyday_moving_avg()); data[14][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Percent 50 Day MA: ", currentStock.get_percent_change_from_fiftyday_moving_avg()); } else { data[13][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Change 50 Day MA: ", currentStock.get_change_from_fiftyday_moving_avg()); data[14][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Percent 50 Day MA: ", currentStock.get_percent_change_from_fiftyday_moving_avg()); } if (currentStock.get_change_from_twohundredday_moving_avg() != null && currentStock.get_change_from_twohundredday_moving_avg().contains("-")) { data[15][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Change 200 Day MA: ", currentStock.get_change_from_twohundredday_moving_avg()); data[16][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Percent 200 Day MA: ", currentStock.get_percent_change_from_twohundredday_moving_avg()); } else { data[15][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Change 200 Day MA: ", currentStock.get_change_from_twohundredday_moving_avg()); data[16][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Percent 200 Day MA: ", currentStock.get_percent_change_from_twohundredday_moving_avg()); } data[17][0] = "Year High: " + currentStock.get_year_high(); data[18][0] = "Year Low: " + currentStock.get_year_low(); if (currentStock.get_change_from_year_high() != null && currentStock.get_change_from_year_high().contains("-")) { data[19][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year High Change: ", currentStock.get_change_from_year_high()); data[20][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year High Percent: ", currentStock.get_percent_change_from_year_high()); } else { data[19][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year High Change: ", currentStock.get_change_from_year_high()); data[20][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year High Percent: ", currentStock.get_percent_change_from_year_high()); } if (currentStock.get_change_from_year_low() != null && currentStock.get_change_from_year_low().contains("-")) { data[21][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year Low Change: ", currentStock.get_change_from_year_low()); data[22][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year Low Percent: ", currentStock.get_percent_change_from_year_low()); } else { data[21][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year Low Change: ", currentStock.get_change_from_year_low()); data[22][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year Low Percent: ", currentStock.get_percent_change_from_year_low()); } if (currentStock.get_five_day_change()[0] != null && currentStock.get_five_day_change()[0].contains("-")) data[11][1] = String.format("<html>%s<font color='red'>%s</font></html>", "5D Change: ", currentStock.get_five_day_change()[0] + " (" + currentStock.get_five_day_change()[1] + ")"); else data[11][1] = String.format("<html>%s<font color='green'>%s</font></html>", "5D Change: ", currentStock.get_five_day_change()[0] + " (" + currentStock.get_five_day_change()[1] + ")"); if (currentStock.get_one_month_change()[0] != null && currentStock.get_one_month_change()[0].contains("-")) data[12][1] = String.format("<html>%s<font color='red'>%s</font></html>", "1M Change: ", currentStock.get_one_month_change()[0] + " (" + currentStock.get_one_month_change()[1] + ")"); else data[12][1] = String.format("<html>%s<font color='green'>%s</font></html>", "1M Change: ", currentStock.get_one_month_change()[0] + " (" + currentStock.get_one_month_change()[1] + ")"); if (currentStock.get_three_month_change()[0] != null && currentStock.get_three_month_change()[0].contains("-")) data[13][1] = String.format("<html>%s<font color='red'>%s</font></html>", "3M Change: ", currentStock.get_three_month_change()[0] + " (" + currentStock.get_three_month_change()[1] + ")"); else data[13][1] = String.format("<html>%s<font color='green'>%s</font></html>", "3M Change: ", currentStock.get_three_month_change()[0] + " (" + currentStock.get_three_month_change()[1] + ")"); if (currentStock.get_six_month_change()[0] != null && currentStock.get_six_month_change()[0].contains("-")) data[14][1] = String.format("<html>%s<font color='red'>%s</font></html>", "6M Change: ", currentStock.get_six_month_change()[0] + " (" + currentStock.get_six_month_change()[1] + ")"); else data[14][1] = String.format("<html>%s<font color='green'>%s</font></html>", "6M Change: ", currentStock.get_six_month_change()[0] + " (" + currentStock.get_six_month_change()[1] + ")"); if (currentStock.get_ytd_change()[0] != null && currentStock.get_ytd_change()[0].contains("-")) data[15][1] = String.format("<html>%s<font color='red'>%s</font></html>", "YTD Change: ", currentStock.get_ytd_change()[0] + " (" + currentStock.get_ytd_change()[1] + ")"); else data[15][1] = String.format("<html>%s<font color='green'>%s</font></html>", "YTD Change: ", currentStock.get_ytd_change()[0] + " (" + currentStock.get_ytd_change()[1] + ")"); if (currentStock.get_one_year_change()[0] != null && currentStock.get_one_year_change()[0].contains("-")) data[16][1] = String.format("<html>%s<font color='red'>%s</font></html>", "1Y Change: ", currentStock.get_one_year_change()[0] + " (" + currentStock.get_one_year_change()[1] + ")"); else data[16][1] = String.format("<html>%s<font color='green'>%s</font></html>", "1Y Change: ", currentStock.get_one_year_change()[0] + " (" + currentStock.get_one_year_change()[1] + ")"); if (currentStock.get_five_year_change()[0] != null && currentStock.get_five_year_change()[0].contains("-")) data[17][1] = String.format("<html>%s<font color='red'>%s</font></html>", "5Y Change: ", currentStock.get_five_year_change()[0] + " (" + currentStock.get_five_year_change()[1] + ")"); else data[17][1] = String.format("<html>%s<font color='green'>%s</font></html>", "5Y Change: ", currentStock.get_five_year_change()[0] + " (" + currentStock.get_five_year_change()[1] + ")"); if (currentStock.get_ten_year_change()[0] != null && currentStock.get_ten_year_change()[0].contains("-")) data[18][1] = String.format("<html>%s<font color='red'>%s</font></html>", "10Y Change: ", currentStock.get_ten_year_change()[0] + " (" + currentStock.get_ten_year_change()[1] + ")"); else data[18][1] = String.format("<html>%s<font color='green'>%s</font></html>", "10Y Change: ", currentStock.get_ten_year_change()[0] + " (" + currentStock.get_ten_year_change()[1] + ")"); if (currentStock.get_max_year_change()[0] != null && currentStock.get_max_year_change()[0].contains("-")) data[19][1] = String.format("<html>%s<font color='red'>%s</font></html>", "Max Change: ", currentStock.get_max_year_change()[0] + " (" + currentStock.get_max_year_change()[1] + ")"); else data[19][1] = String.format("<html>%s<font color='green'>%s</font></html>", "Max Change: ", currentStock.get_max_year_change()[0] + " (" + currentStock.get_max_year_change()[1] + ")"); data[24][0] = "Earnings Est Next Quarter: " + currentStock.get_earnings_estimate_next_quarter(); data[25][0] = "Earnings Est Current Year: " + currentStock.get_earnings_estimate_current_year(); data[26][0] = "Earnings Est Next Year: " + currentStock.get_earnings_estimate_next_year(); data[24][1] = "P/E Est Current Year: " + currentStock.get_price_eps_estimate_current_year(); data[25][1] = "P/E Est Next Year: " + currentStock.get_price_eps_estimate_next_year(); remainingInfoTable.setFont(new Font(remainingInfoTable.getName(), Font.PLAIN, 15)); remainingInfoTable.packColumn(0, 4); remainingInfoTable.packColumn(1, 4); try { dataAndGraph.remove(chartPane); chartPane = new JTabbedPane(); chartPane.setVisible(true); ChartPanel intradayChart = new IntradayChart(currentStock).getChartPanel(); intradayChart.setPopupMenu(graphMenu); chartPane.addTab("1d", intradayChart); chartPane.setMnemonicAt(0, KeyEvent.VK_1); ChartPanel fivedayChart = new FiveDayChart(currentStock).getChartPanel(); fivedayChart.setPopupMenu(graphMenu); chartPane.addTab("5d", fivedayChart); chartPane.setMnemonicAt(0, KeyEvent.VK_2); ChartPanel onemonthChart = new OneMonthChart(currentStock).getChartPanel(); onemonthChart.setPopupMenu(graphMenu); chartPane.addTab("1m", onemonthChart); chartPane.setMnemonicAt(0, KeyEvent.VK_3); ChartPanel threemonthChart = new ThreeMonthChart(currentStock).getChartPanel(); threemonthChart.setPopupMenu(graphMenu); chartPane.addTab("3m", threemonthChart); chartPane.setMnemonicAt(0, KeyEvent.VK_4); ChartPanel sixmonthChart = new SixMonthChart(currentStock).getChartPanel(); sixmonthChart.setPopupMenu(graphMenu); chartPane.addTab("6m", sixmonthChart); chartPane.setMnemonicAt(0, KeyEvent.VK_5); ChartPanel ytdChart = new YTDChart(currentStock).getChartPanel(); ytdChart.setPopupMenu(graphMenu); chartPane.addTab("ytd", ytdChart); chartPane.setMnemonicAt(0, KeyEvent.VK_6); ChartPanel oneyearChart = new OneYearChart(currentStock).getChartPanel(); oneyearChart.setPopupMenu(graphMenu); chartPane.addTab("1y", oneyearChart); chartPane.setMnemonicAt(0, KeyEvent.VK_7); ChartPanel fiveyearChart = new FiveYearChart(currentStock).getChartPanel(); fiveyearChart.setPopupMenu(graphMenu); chartPane.addTab("5y", fiveyearChart); chartPane.setMnemonicAt(0, KeyEvent.VK_8); ChartPanel tenyearChart = new TenYearChart(currentStock).getChartPanel(); tenyearChart.setPopupMenu(graphMenu); chartPane.addTab("10y", tenyearChart); chartPane.setMnemonicAt(0, KeyEvent.VK_9); ChartPanel maxChart = new MaxChart(currentStock).getChartPanel(); maxChart.setPopupMenu(graphMenu); chartPane.addTab("max", maxChart); chartPane.setMnemonicAt(0, KeyEvent.VK_0); c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 0; c.gridheight = 2; //c.ipady = 20; c.gridx = 1; c.gridy = 0; dataAndGraph.add(chartPane, c); } catch (ParseException ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } chartPane.revalidate(); chartPane.repaint(); revalidate(); repaint(); finished = true; }