[quote=mauricioadl][quote=matheushac][quote=mauricioadl]tenta remover essas linhas, elas sao desnecessarias
Dimension imagepanelsize = new Dimension(800,800);
imagepanel.setMinimumSize(imagepanelsize);
imagepanel.setPreferredSize(imagepanelsize);
imagepanel.setMaximumSize(imagepanelsize);
[/quote]
tirando essas linhas o panel não aparece, ele fica sem dimensão nenhuma e,
também eu queria o panel fosse nesse tamanho q está ai msm e que a tabela ficasse com tamanho igual.
obs.: Meu Panel não ocupará a tela inteira, outro panel será colocado ao lado, por isso eu definir o tamanho dele ai.[/quote]
entendi. coloque o codigo do frame todo pra mim ver.[/quote]
[code]public class Squares extends JFrame {
private static final long serialVersionUID = 1L;
private MyTableModel model;
private MyTable table;
private static BufferedImage loadImage(String file) throws IOException {
return ImageIO.read(new File(file));
}
private void ResizeColumns(){
int columns = table.getColumnCount();
for(int i=0; i<columns; i++){
table.getColumnModel().getColumn(i).setMinWidth(1);
}
}
public Squares(String[][] data,Double min, Double max, Float[][] colormap, String path) throws Throwable{
super("Quadrículas");
BuildMatrix aux = new BuildMatrix();
Object dados[][] = null;
dados = aux.BuildM(data.length, data[0].length);
model = new MyTableModel(dados);
table = new MyTable(model, data){
Action action = new AbstractAction() {
public void actionPerformed(ActionEvent e){
TableCellListener tcl = (TableCellListener)e.getSource();
TableCellRenderer tcr = table.getDefaultRenderer(getClass());
if(tcr instanceof CustomTableCellRenderer){
double min = ((CustomTableCellRenderer) tcr).GetMin();
double max = ((CustomTableCellRenderer) tcr).GetMax();
String newval = (String)tcl.getNewValue() ;
Double newvalue = Double.parseDouble(newval);
if (newvalue >< min){
((CustomTableCellRenderer) tcr).SetMin(newvalue);
table.repaint();
}
if (newvalue > max){
((CustomTableCellRenderer) tcr).SetMax(newvalue);
table.repaint();
}
}
table.setData(tcl.getRow(), tcl.getColumn(), tcl.getNewValue());
table.setValueAt("", tcl.getRow(), tcl.getColumn());
}
};
TableCellListener tcl = new TableCellListener(this, action);
};
ResizeColumns();
this.setSize(900, 900);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
MyImagePanel imagepanel = new MyImagePanel(loadImage(path));
imagepanel.setLayout(new BorderLayout());
table.setLayout(new BorderLayout());
Dimension imagepanelsize = new Dimension(800,800);
imagepanel.setMinimumSize(imagepanelsize);
imagepanel.setPreferredSize(imagepanelsize);
imagepanel.setMaximumSize(imagepanelsize);
imagepanel.add(table, BorderLayout.CENTER);
JPanel ColorBarPanel = new JPanel();
Dimension ColorBarPanelSize = new Dimension(50,800);
ColorBarPanel.setMinimumSize(ColorBarPanelSize);
ColorBarPanel.setPreferredSize(ColorBarPanelSize);
ColorBarPanel.setMaximumSize(ColorBarPanelSize);
ColorBarPanel.setBackground(Color.red);
panel.add(imagepanel, BorderLayout.WEST);
panel.add(ColorBarPanel, BorderLayout.EAST);
this.getContentPane().add(panel);
this.setResizable(false);
this.pack();
this.setVisible(true);
this.table.setDefaultRenderer(Object.class, new CustomTableCellRenderer(min, max, colormap));
}
public static void main (String [] args) throws Throwable{
}
}
[/code]