public void layoutConverters() { GridBagLayout gridbag = (GridBagLayout) getLayout(); int x = 0; int y = 0; GridBagConstraints c = createConstraints(x, y++); ImageIcon icon = createImageIcon("images/lb.png", "EU"); JLabel label = new JLabel(icon); gridbag.setConstraints(label, c); add(label); int ignore_metric = 0; for (WeightMultipliers wm : WeightMultipliers.values()) { /* values returns all enum values in order of declartion but we want to ingore the first 6 (metric) values. */ if (ignore_metric > 5) { newTextPane( createConstraints(x, y++), gridbag, new DocumentPositiveNumberFilter(cValue, wm, frame), labels[ignore_metric - 6]); } ignore_metric++; } // FIXME: Is there a cleaner way to iterate over a chunk of what values() returns? }
public void layoutConverters() { GridBagLayout gridbag = (GridBagLayout) getLayout(); int x = 0; int y = 0; GridBagConstraints c = createConstraints(x, y++); ImageIcon icon = createImageIcon("images/kg.png", "EU"); JLabel label = new JLabel(icon); gridbag.setConstraints(label, c); add(label); int just_metric = 0; for (WeightMultipliers wm : WeightMultipliers.values()) { if (just_metric > 5) { return; } newTextPane( createConstraints(x, y++), gridbag, new DocumentPositiveNumberFilter(cValue, wm, frame), labels[just_metric]); just_metric++; } }