下面列出了java.awt.FlowLayout#setAlignment ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* If width or height is not greater than 0, preferred size will not be set
*/
public static JPanel createPanel(int width, int height, int vGap, int hGap, int alignment) {
FlowLayout flowLayout1 = new FlowLayout();
JPanel controlPanel = new JPanel();
controlPanel.setLayout(flowLayout1);
flowLayout1.setAlignment(alignment);
if (width > 0 && height > 0)
controlPanel.setPreferredSize(new java.awt.Dimension(width, height));
controlPanel.setBackground(JPlagCreator.SYSTEMCOLOR);
controlPanel.setBorder(JPlagCreator.LINE);
flowLayout1.setVgap(vGap);
flowLayout1.setHgap(hGap);
return controlPanel;
}
/**
* Build the panel of shapes for a given set.
*
* @param set the given set of shapes
* @return the panel of shapes for the provided set
*/
private Panel buildShapesPanel (ShapeSet set)
{
Panel panel = new Panel();
panel.setNoInsets();
panel.setPreferredSize(new Dimension(BOARD_WIDTH, getSetHeight(set)));
FlowLayout layout = new FlowLayout();
layout.setAlignment(FlowLayout.LEADING);
panel.setLayout(layout);
// Button to close this shapes panel and return to sets panel
JButton close = new JButton(set.getName());
close.addActionListener(closeListener);
close.setToolTipText("Back to shape sets");
close.setBorderPainted(false);
panel.add(close);
panel.addKeyListener(keyListener);
// One button per shape
addButtons(panel, set.getSortedShapes());
return panel;
}
public TurnsPanel() {
FlowLayout flowLayout = (FlowLayout) getLayout();
flowLayout.setVgap(1);
flowLayout.setHgap(1);
flowLayout.setAlignment(FlowLayout.LEFT);
lblTurnNumber = new JLabel("Turn " + GameManager.getInstance().getTurns().size());
add(lblTurnNumber);
add(new JButton(new UntapPhase()));
add(new JButton(new UpkeepPhase()));
add(new JButton(new DrawPhase()));
add(new JButton(new MainPhase(1)));
add(new JButton(new CombatPhase()));
add(new JButton(new AttackPhase()));
add(new JButton(new BlockPhase()));
add(new JButton(new DamagePhase()));
add(new JButton(new EndCombatPhase()));
add(new JButton(new MainPhase(2)));
add(new JButton(new EndPhase()));
add(new JButton(new CleanUpPhase()));
add(new JButton(new EndTurnPhase()));
}
/**
* Constructor.
*
* @param label fixed label text
*/
public JLabelledValue(String label)
{
FlowLayout flowLayout = (FlowLayout) getLayout();
flowLayout.setAlignment(FlowLayout.LEFT);
flowLayout.setVgap(0);
flowLayout.setHgap(0);
JLabel textLabel = new JLabel(label);
textLabel.setFont(new Font("Tahoma", Font.BOLD, 11));
textLabel.setPreferredSize(new Dimension(70, 14));
add(textLabel);
m_valueLabel = new JLabel("");
m_valueLabel.setPreferredSize(new Dimension(80, 14));
add(m_valueLabel);
}
public static JPanel createPanel(String title, int width, int height, int vGap, int hGap, int alignment, int type) {
FlowLayout flowLayout1 = new FlowLayout();
JPanel controlPanel = new JPanel();
controlPanel.setLayout(flowLayout1);
flowLayout1.setAlignment(alignment);
controlPanel.setPreferredSize(new java.awt.Dimension(width, height));
controlPanel.setBackground(JPlagCreator.SYSTEMCOLOR);
if (type == WITH_LINEBORDER)
controlPanel.setBorder(JPlagCreator.LINE);
if (type == WITH_TITLEBORDER)
controlPanel.setBorder(JPlagCreator.titleBorder(title, Color.BLACK, Color.BLACK));
flowLayout1.setVgap(vGap);
flowLayout1.setHgap(hGap);
return controlPanel;
}
/** Create a bank of radio buttons. A radio button provides a list of
* choices, only one of which may be chosen at a time.
* @param name The name used to identify the entry (when calling get).
* @param label The label to attach to the entry.
* @param values The list of possible choices.
* @param defaultValue Default value.
*/
public void addRadioButtons(
String name,
String label,
String[] values,
String defaultValue) {
JLabel lbl = new JLabel(label + ": ");
lbl.setBackground(_background);
FlowLayout flow = new FlowLayout();
flow.setAlignment(FlowLayout.LEFT);
// This must be a JPanel, not a Panel, or the scroll bars won't work.
JPanel buttonPanel = new JPanel(flow);
ButtonGroup group = new ButtonGroup();
QueryActionListener listener = new QueryActionListener(name);
// Regrettably, ButtonGroup provides no method to find out
// which button is selected, so we have to go through a
// song and dance here...
JRadioButton[] buttons = new JRadioButton[values.length];
for (int i = 0; i < values.length; i++) {
JRadioButton checkbox = new JRadioButton(values[i]);
buttons[i] = checkbox;
checkbox.setBackground(_background);
// The following (essentially) undocumented method does nothing...
// checkbox.setContentAreaFilled(true);
checkbox.setOpaque(false);
if (values[i].equals(defaultValue)) {
checkbox.setSelected(true);
}
group.add(checkbox);
buttonPanel.add(checkbox);
// Add the listener last so that there is no notification
// of the first value.
checkbox.addActionListener(listener);
}
_addPair(name, lbl, buttonPanel, buttons);
}
/**
* Define the panel of shapes for a given range.
*
* @param range the given range of shapes
* @return the panel of shapes for the provided range
*/
private Panel defineShapesPanel (ShapeSet range)
{
Panel panel = new Panel();
panel.setNoInsets();
panel.setPreferredSize(new Dimension(BOARD_WIDTH, heights.get(range)));
FlowLayout layout = new FlowLayout();
layout.setAlignment(FlowLayout.LEADING);
panel.setLayout(layout);
// Button to close this shapes panel and return to ranges panel
JButton close = new JButton(range.getName());
close.addActionListener(closeListener);
close.setToolTipText("Back to ranges");
close.setBorderPainted(false);
panel.add(close);
// One button per shape
for (Shape shape : range.getSortedShapes()) {
ShapeButton button = new ShapeButton(shape);
button.addMouseListener(dropAdapter); // For DnD transfer
button.addMouseListener(mouseListener); // For double-click
button.addMouseMotionListener(motionAdapter); // For dragging
panel.add(button);
}
return panel;
}
/**
* Creates a FastChoice with the given data model.
*/
public JChoice(ComboBoxModel<E> model) {
layout = new FlowLayout();
layout.setHgap(0);
layout.setVgap(0);
layout.setAlignment(FlowLayout.LEFT);
setLayout(layout);
this.model = model;
//by default nothing is selected
setSelectedItem(null);
initLocalData();
buildGui();
}
public ShapeHistory ()
{
panel.setNoInsets();
panel.setPreferredSize(new Dimension(BOARD_WIDTH, 80));
panel.setVisible(false);
FlowLayout layout = new FlowLayout();
layout.setAlignment(FlowLayout.LEADING);
panel.setLayout(layout);
}
public ListRenderer() {
userName = new JLabel();
symbolAfterUserName = new JLabel();
message = new JLabel();
giftNumber = new JLabel();
giftUnit = new JLabel();
giftName = new JLabel();
FlowLayout layout=new FlowLayout();
setLayout(layout);
layout.setAlignment(FlowLayout.LEFT);
add(userName);
add(symbolAfterUserName);
add(message);
add(giftNumber);
add(giftUnit);
add(giftName);
userName.setForeground(new Color(0x6D40DB));
symbolAfterUserName.setForeground(Color.yellow);
message.setForeground(Color.white);
giftNumber.setForeground(new Color(0xFF3C61));
giftUnit.setForeground(Color.white);
giftName.setForeground(new Color(0x24B073));
userName.setFont(new Font("微软雅黑 ", Font.PLAIN, 12));
symbolAfterUserName.setFont(new Font("微软雅黑 ", Font.PLAIN, 12));
message.setFont(new Font("微软雅黑 ", Font.PLAIN, 12));
giftNumber.setFont(new Font("微软雅黑 ", Font.PLAIN, 12));
giftUnit.setFont(new Font("微软雅黑 ", Font.PLAIN, 12));
giftName.setFont(new Font("微软雅黑 ", Font.PLAIN, 12));
setOpaque(false);
}
/**
* Define the global panel of ranges.
*
* @return the global panel of ranges
*/
private Panel defineRangesPanel ()
{
Panel panel = new Panel();
panel.setNoInsets();
panel.setPreferredSize(new Dimension(BOARD_WIDTH, 180));
FlowLayout layout = new FlowLayout();
layout.setAlignment(FlowLayout.LEADING);
panel.setLayout(layout);
for (ShapeSet range : ShapeSet.getShapeSets()) {
Shape rep = range.getRep();
if (rep != null) {
JButton button = new JButton();
button.setIcon(rep.getDecoratedSymbol());
button.setName(range.getName());
button.addActionListener(rangeListener);
button.setToolTipText(range.getName());
button.setBorderPainted(false);
panel.add(button);
}
}
return panel;
}
/**
* Creates a new label/component pair. If given multiple compnents, will add
* them to a JPanel and then set that as the component. Note that this is better
* than putting them into a JPanel yourself: the label will be centered on the
* first component passed-in.
*
* @param label the JLabel of the option
* @param components
*/
public Option(JLabel label, JComponent... components) {
setLabel(label);
if (components.length > 1) {
JPanel panel = new JPanel();
FlowLayout flow = (FlowLayout) panel.getLayout();
flow.setAlignment(FlowLayout.LEFT);
flow.setVgap(0);
flow.setHgap(0);
for (JComponent jc : components) {
panel.add(jc);
}
JUtils.fixHeight(panel);
setComponent(panel);
} else {
setComponent((components.length > 0) ? components[0] : null);
}
// We try to align the label with the first component (descending into
// JPanels), by creating a border that aligns the middle of the border
// with the middle of the first component.
if (components.length > 0) {
int labelOffset = -label.getPreferredSize().height;
Component comp = components[0];
while (comp instanceof JPanel) {
labelOffset += 2 * (((JPanel) comp).getInsets().top);
comp = ((JPanel) comp).getComponent(0);
}
if (comp != null) {
labelOffset += comp.getPreferredSize().height;
if (labelOffset > 0) { // Only do it if the first non-JPanel
// component is bigger
label.setBorder(new EmptyBorder(labelOffset / 2, 0, 0, 0));
}
}
}
}
public MultiSpectraVisualizerWindow(PeakListRow row, RawDataFile raw) {
setBackground(Color.WHITE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
setMinimumSize(new Dimension(800, 600));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
pnGrid = new JPanel();
// any number of rows
pnGrid.setLayout(new GridLayout(0, 1, 0, 25));
pnGrid.setAutoscrolls(true);
JScrollPane scrollPane = new JScrollPane(pnGrid);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
getContentPane().add(scrollPane, BorderLayout.CENTER);
JPanel pnMenu = new JPanel();
FlowLayout fl_pnMenu = (FlowLayout) pnMenu.getLayout();
fl_pnMenu.setVgap(0);
fl_pnMenu.setAlignment(FlowLayout.LEFT);
getContentPane().add(pnMenu, BorderLayout.NORTH);
JButton nextRaw = new JButton("next");
nextRaw.addActionListener(e -> nextRaw());
JButton prevRaw = new JButton("prev");
prevRaw.addActionListener(e -> prevRaw());
pnMenu.add(prevRaw);
pnMenu.add(nextRaw);
lbRaw = new JLabel();
pnMenu.add(lbRaw);
JLabel lbRawTotalWithFragmentation = new JLabel();
pnMenu.add(lbRaw);
int n = 0;
for (Feature f : row.getPeaks()) {
if (f.getMostIntenseFragmentScanNumber() > 0)
n++;
}
lbRawTotalWithFragmentation.setText("(total raw:" + n + ")");
// add charts
setData(row, raw);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
validate();
repaint();
pack();
}
/**
* Create a bank of radio buttons. A radio button provides a list of
* choices, only one of which may be chosen at a time.
*
* @param name
* The name used to identify the entry (when calling get).
* @param label
* The label to attach to the entry.
* @param values
* The list of possible choices.
* @param defaultValue
* Default value.
*/
public void addRadioButtons(String name, String label, String[] values, String defaultValue) {
JLabel lbl = new JLabel(label + ": ");
lbl.setBackground(_background);
FlowLayout flow = new FlowLayout();
flow.setAlignment(FlowLayout.LEFT);
// This must be a JPanel, not a Panel, or the scroll bars won't work.
JPanel buttonPanel = new JPanel(flow);
ButtonGroup group = new ButtonGroup();
QueryActionListener listener = new QueryActionListener(name);
// Regrettably, ButtonGroup provides no method to find out
// which button is selected, so we have to go through a
// song and dance here...
JRadioButton[] buttons = new JRadioButton[values.length];
for (int i = 0; i < values.length; i++) {
JRadioButton checkbox = new JRadioButton(values[i]);
buttons[i] = checkbox;
checkbox.setBackground(_background);
// The following (essentially) undocumented method does nothing...
// checkbox.setContentAreaFilled(true);
checkbox.setOpaque(false);
if (values[i].equals(defaultValue)) {
checkbox.setSelected(true);
}
group.add(checkbox);
buttonPanel.add(checkbox);
// Add the listener last so that there is no notification
// of the first value.
checkbox.addActionListener(listener);
}
_addPair(name, lbl, buttonPanel, buttons);
}
/**
* Create a bank of buttons that provides a list of choices, any subset of
* which may be chosen at a time.
*
* @param name
* The name used to identify the entry (when calling get).
* @param label
* The label to attach to the entry.
* @param values
* The list of possible choices.
* @param initiallySelected
* The initially selected choices, or null to indicate that none
* are selected.
*/
public void addSelectButtons(String name, String label, String[] values, Set<String> initiallySelected) {
JLabel lbl = new JLabel(label + ": ");
lbl.setBackground(_background);
FlowLayout flow = new FlowLayout();
flow.setAlignment(FlowLayout.LEFT);
// This must be a JPanel, not a Panel, or the scroll bars won't work.
JPanel buttonPanel = new JPanel(flow);
QueryActionListener listener = new QueryActionListener(name);
if (initiallySelected == null) {
initiallySelected = new HashSet<String>();
}
JRadioButton[] buttons = new JRadioButton[values.length];
for (int i = 0; i < values.length; i++) {
JRadioButton checkbox = new JRadioButton(values[i]);
buttons[i] = checkbox;
checkbox.setBackground(_background);
// The following (essentially) undocumented method does nothing...
// checkbox.setContentAreaFilled(true);
checkbox.setOpaque(false);
if (initiallySelected.contains(values[i])) {
checkbox.setSelected(true);
}
buttonPanel.add(checkbox);
// Add the listener last so that there is no notification
// of the first value.
checkbox.addActionListener(listener);
}
_addPair(name, lbl, buttonPanel, buttons);
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
FlowLayout flowLayout1 = new FlowLayout();
this.setLayout(flowLayout1);
packing = JPlagCreator.createLabel(Messages.getString(
"ProgressPanel.Packing_files"), 200, 20); //$NON-NLS-1$
sending = JPlagCreator.createLabel(Messages.getString(
"ProgressPanel.Sending_files"), 200, 20); //$NON-NLS-1$
waiting = JPlagCreator.createLabel(Messages.getString(
"ProgressPanel.Waiting_in_queue"),200, 20); //$NON-NLS-1$
parsing = JPlagCreator.createLabel(Messages.getString(
"ProgressPanel.Parsing_files"), 200, 20); //$NON-NLS-1$
comparing = JPlagCreator.createLabel(Messages.getString(
"ProgressPanel.Comparing_files"), 200, 20); //$NON-NLS-1$
loading = JPlagCreator.createLabel(Messages.getString(
"ProgressPanel.Loading_results"), 200, 20); //$NON-NLS-1$
loading.setBackground(Color.WHITE);
this.setPreferredSize(new java.awt.Dimension(200, 120));
// TODO: Upload missing file to repository!!
packing.setIcon(new ImageIcon(getClass().getResource(
"/atujplag/data/current.gif"))); //$NON-NLS-1$
sending.setIcon(new ImageIcon(getClass().getResource(
"/atujplag/data/current.gif"))); //$NON-NLS-1$
waiting.setIcon(new ImageIcon(getClass().getResource(
"/atujplag/data/current.gif"))); //$NON-NLS-1$
parsing.setIcon(new ImageIcon(getClass().getResource(
"/atujplag/data/current.gif"))); //$NON-NLS-1$
comparing.setIcon(new ImageIcon(getClass().getResource(
"/atujplag/data/current.gif"))); //$NON-NLS-1$
loading.setIcon(new ImageIcon(getClass().getResource(
"/atujplag/data/current.gif"))); //$NON-NLS-1$
flowLayout1.setHgap(50);
flowLayout1.setVgap(0);
flowLayout1.setAlignment(java.awt.FlowLayout.CENTER);
this.setBackground(JPlagCreator.SYSTEMCOLOR);
this.add(packing);
this.add(sending);
this.add(waiting);
this.add(parsing);
this.add(comparing);
this.add(loading);
}
public MagicEditionsJLabelRenderer() {
FlowLayout flowLayout = new FlowLayout();
flowLayout.setVgap(0);
flowLayout.setAlignment(FlowLayout.LEFT);
pane.setLayout(flowLayout);
}
public MagicEditionJLabelRenderer() {
FlowLayout flowLayout = new FlowLayout();
flowLayout.setVgap(0);
flowLayout.setAlignment(FlowLayout.LEFT);
pane.setLayout(flowLayout);
}
public DeckDetailsPanel() {
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 0, 140, 0, 0, 0 };
gridBagLayout.rowHeights = new int[] { 28, 30, 35, 0, 132, 31, 0, 0, 0, 0 };
gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 1.0E-4 };
gridBagLayout.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0E-4 };
setLayout(gridBagLayout);
add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("DECK_NAME") + " :"), UITools.createGridBagConstraints(null, null, 1, 0));
nameJTextField = new JTextField();
add(nameJTextField, UITools.createGridBagConstraints(null, GridBagConstraints.HORIZONTAL, 2, 0));
add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("CARD_LEGALITIES") + " :"), UITools.createGridBagConstraints(null, null, 1, 1));
panelLegalities = new JPanel();
FlowLayout flowLayout = (FlowLayout) panelLegalities.getLayout();
flowLayout.setHgap(10);
flowLayout.setAlignment(FlowLayout.LEFT);
add(panelLegalities, UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 2, 1));
add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("CARD_COLOR") + " :"), UITools.createGridBagConstraints(null, null, 1, 2));
manaPanel = new ManaPanel();
add(manaPanel, UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 2, 2));
lblDate = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("DATE") + " :");
add(lblDate, UITools.createGridBagConstraints(null, null, 1, 3));
lblDateInformation = new JLabel("");
add(lblDateInformation, UITools.createGridBagConstraints(GridBagConstraints.WEST, null, 2, 3));
add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("DESCRIPTION") + " :"), UITools.createGridBagConstraints(null, null, 1, 4));
textArea = new JTextArea();
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("QTY") + " :"), UITools.createGridBagConstraints(null, null, 1, 5));
nbCardsProgress = new JProgressBar();
nbCardsProgress.setStringPainted(true);
add(nbCardsProgress, UITools.createGridBagConstraints(null, GridBagConstraints.HORIZONTAL, 2, 5));
lbstd = new JLabel(" STD ");
lbstd.setOpaque(true);
lbstd.setBackground(Color.GREEN);
lbmnd = new JLabel(" MDN ");
lbmnd.setOpaque(true);
lbmnd.setBackground(Color.GREEN);
lbvin = new JLabel(" VIN ");
lbvin.setOpaque(true);
lbvin.setBackground(Color.GREEN);
lbcmd = new JLabel(" CMD ");
lbcmd.setOpaque(true);
lbcmd.setBackground(Color.GREEN);
lbLeg = new JLabel(" LEG ");
lbLeg.setOpaque(true);
lbLeg.setBackground(Color.GREEN);
panelLegalities.add(lbvin);
panelLegalities.add(lbLeg);
panelLegalities.add(lbstd);
panelLegalities.add(lbmnd);
panelLegalities.add(lbcmd);
add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("SIDEBOARD") + " :"), UITools.createGridBagConstraints(null, null, 1, 6));
nbSideProgress = new JProgressBar();
nbSideProgress.setMaximum(15);
nbSideProgress.setStringPainted(true);
add(nbSideProgress, UITools.createGridBagConstraints(null, GridBagConstraints.HORIZONTAL, 2, 6));
add(new JScrollPane(textArea), UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 2, 4));
add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("TAGS") + " :"), UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 1, 7));
tagsPanel = new JTagsPanel();
add(tagsPanel, UITools.createGridBagConstraints(GridBagConstraints.WEST, GridBagConstraints.VERTICAL, 2, 7));
panel = new JPanel();
add(panel, UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 2, 8));
if (magicDeck != null) {
mBindingGroup = initDataBindings();
}
}
public MultiSpectraVisualizerWindow(PeakListRow row, RawDataFile raw) {
setBackground(Color.WHITE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
setMinimumSize(new Dimension(800, 600));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
pnGrid = new JPanel();
// any number of rows
pnGrid.setLayout(new GridLayout(0, 1, 0, 25));
pnGrid.setAutoscrolls(true);
JScrollPane scrollPane = new JScrollPane(pnGrid);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
getContentPane().add(scrollPane, BorderLayout.CENTER);
JPanel pnMenu = new JPanel();
FlowLayout fl_pnMenu = (FlowLayout) pnMenu.getLayout();
fl_pnMenu.setVgap(0);
fl_pnMenu.setAlignment(FlowLayout.LEFT);
getContentPane().add(pnMenu, BorderLayout.NORTH);
JButton nextRaw = new JButton("next");
nextRaw.addActionListener(e -> nextRaw());
JButton prevRaw = new JButton("prev");
prevRaw.addActionListener(e -> prevRaw());
pnMenu.add(prevRaw);
pnMenu.add(nextRaw);
lbRaw = new JLabel();
pnMenu.add(lbRaw);
JLabel lbRawTotalWithFragmentation = new JLabel();
pnMenu.add(lbRaw);
int n = 0;
for (Feature f : row.getPeaks()) {
if (f.getMostIntenseFragmentScanNumber() > 0)
n++;
}
lbRawTotalWithFragmentation.setText("(total raw:" + n + ")");
// add charts
setData(row, raw);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
validate();
repaint();
pack();
}