0

我为一个朋友写了一个价格计算器(runescape dungeoneering,但这并不是特别重要)。他是一个相当大的团队中的一员,而其他管理员之一在这方面遇到了麻烦。

我在 Windows 7、Java 6u32(我相信是 u32)上的 Eclipse 中编写了这个。他正在运行 Mac OS X 版本 10.7.4,Java 6u33。每当他加载页面时,文本字段都无法正确显示。其中一半在行尾用椭圆缩短。

问题图片:

http://puu.sh/KckA

另外,作为一个附带问题,我想知道为什么图像只在绘制一次后才出现?

感谢您的所有帮助,并对命名错误的变量感到抱歉!我无法弄清楚如何将代码正确嵌入到帖子中,所以我意识到这是非常糟糕的空间 - 我只是复制/粘贴它并使用空间来缩进导入:/。

import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import javax.imageio.ImageIO;
import javax.swing.ButtonGroup;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;

public class IHideKeysCalc extends JApplet implements ActionListener {

JRadioButton t = new JRadioButton("Get a chaotic at your current level."), z = new JRadioButton("Get to a certain level.");
JRadioButton t2 = new JRadioButton("Yes."), z2 = new JRadioButton("No.");
JTextField startLevel = new JTextField(), endLevel = new JTextField();
JLabel e = new JLabel("What is your ending level?"), p = new JLabel("What is your starting level?");
JLabel cost = new JLabel("It will cost: 0m");
JLabel chaotics = new JLabel("You will gain: 0 chaotics");
JLabel time = new JLabel("It will take: 0 hours");
JButton calc = new JButton("Calculate!");
JLabel leech = new JLabel("Will you leech c1s from us?");
Color dots = new Color(215, 215, 215);

double[] normalCost = new double[] {0.147408147408147, 0.161616161616162, 0.156052782558807, 0.171352074966533, 0.166624674561182, 0.18543713781809, 0.180714893457874, 0.201060278814058, 0.206251654890812, 0.227434257285004, 0.228290358693966, 0.251523448295564, 0.253108393640709, 0.280820991484583, 0.28508229125052, 0.314016016332662, 0.321855573638658, 0.354987765042637, 0.365389331821599, 0.402884011746955, 0.413233529990681, 0.454829644395684, 0.469244088131267, 0.518269589876325, 0.536842873549166, 0.591842366162221, 0.617068005673544, 0.680805377374742, 0.711865189407446, 0.785616988310019, 0.824813238661612, 0.910191318818822, 0.958469472772604, 1.05785553342935, 1.11731759927444, 1.2328062178794, 1.30540086348993, 1.44105580841818, 1.52112093542576, 1.67893297878229, 1.79759198326453, 1.98403337299274, 2.0576867439263, 2.27198067413181, 2.34861652795415, 2.59287845397998, 2.67171019944355, 2.94948405053316, 2.30627996576819, 2.54621754023429, 2.63839002652197, 2.91292672667821, 3.02782375824338, 3.34294815274889, 2.99278604307127, 3.30403304019601, 3.44280379223394, 3.8011722050782, 3.35899412255012, 3.70845630500912, 3.7979745635451, 4.19312491872546, 4.11809281699623, 4.5465605645372, 4.59525960492191, 5.07347042913889, 5.11281698937835, 5.64488890579082, 5.81225689595036, 6.41724086226737, 6.46511043188491, 7.13790513866952, 7.31926635024289, 8.08104832531242, 8.18451767951496, 9.03633826548025, 9.03072096418207, 9.97065806503748, 11.6582196154413, 12.8716058180737, 13.3368037528554, 14.7248844101516, 15.2703841396691, 16.8597698035761, 17.5341941654067, 19.3591671629348, 20.1405224921476, 22.2368354307871, 23.1540859239001, 25.5640472079718, 26.7502409626548, 29.534621910156, 31.0514204050245, 34.2834446556508, 36.3576095095093, 40.1419477374292, 42.8132373341253, 47.2695988929749, 50.5171187677128, 55.775336875572, 59.0583839135564, 65.2056239687282, 69.5517856204352, 76.791366428954, 80.8126533895158, 89.2243342865382, 94.9773484573605, 104.863428916985, 112.165424237996, 123.840557129701, 130.059514288612, 143.597320738684, 154.344556268421, 170.410147105144, 178.81609217768, 197.428905849894, 209.623017271163, 231.442490011038, 248.40964248305, 2418.96525482347};
double[] normalCost2 = new double[] {0.147408147408147, 0.161616161616162, 0.156052782558807, 0.171352074966533, 0.166624674561182, 0.18543713781809, 0.180714893457874, 0.201060278814058, 0.206251654890812, 0.227434257285004, 0.228290358693966, 0.251523448295564, 0.253108393640709, 0.280820991484583, 0.28508229125052, 0.314016016332662, 0.321855573638658, 0.354987765042637, 0.365389331821599, 0.402884011746955, 0.413233529990681, 0.454829644395684, 0.469244088131267, 0.518269589876325, 0.536842873549166, 0.591842366162221, 0.617068005673544, 0.680805377374742, 0.711865189407446, 0.785616988310019, 0.824813238661612, 0.910191318818822, 0.958469472772604, 1.05785553342935, 1.11731759927444, 1.2328062178794, 1.30540086348993, 1.44105580841818, 1.52112093542576, 1.67893297878229, 1.79759198326453, 1.98403337299274, 2.0576867439263, 2.27198067413181, 2.34861652795415, 2.59287845397998, 2.67171019944355, 2.94948405053316, 2.30627996576819, 2.54621754023429, 2.63839002652197, 2.91292672667821, 3.02782375824338, 3.34294815274889, 2.99278604307127, 3.30403304019601, 3.44280379223394, 3.8011722050782, 3.35899412255012, 3.70845630500912, 3.7979745635451, 4.19312491872546, 4.11809281699623, 4.5465605645372, 4.59525960492191, 5.07347042913889, 5.11281698937835, 5.64488890579082, 5.81225689595036, 6.41724086226737, 6.46511043188491, 7.13790513866952, 7.31926635024289, 8.08104832531242, 8.18451767951496, 9.03633826548025, 9.03072096418207, 9.97065806503748, 9.16677990396157, 10.1208573381611, 10.6767809960961, 11.7880092526936, 12.4151865893764, 13.7073950498449, 14.4486866969796, 15.952517601496, 16.79338694904, 18.5413155024615, 19.5087629499962, 21.5393057908644, 22.749431329251, 25.1173757245215, 26.628575651853, 29.4002428137358, 31.4882868073428, 34.7657940225949, 37.4024999022994, 41.2956664355536, 44.4734040636548, 49.1025449226364, 52.3507084560114, 57.7997632829849, 62.0331408031167, 68.4901128512714, 72.4784892775103, 80.0226781901313, 85.613081327045, 94.52444623818, 101.572293638011, 112.144803254013, 118.272870806207, 130.583813546741, 140.900446941876, 155.566652113006, 163.822838496629, 180.875017252225, 192.680242742557, 212.736157206356, 229.030482784318, 2230.25473010176};
double[] normalTokens = new double[] {8.3, 9.1, 10.2, 11.2, 12.4, 13.8, 15.1, 16.8, 18.5, 20.4, 22.6, 24.9, 27.4, 30.4, 33.5, 36.9, 40.8, 45, 49.7, 54.8, 60.6, 66.7, 73.7, 81.4, 89.8, 99, 109.4, 120.7, 133.2, 147, 162.3, 179.1, 197.7, 218.2, 240.9, 265.8, 293.5, 324, 357.6, 394.7, 435.8, 481, 531, 586.3, 647.1, 714.4, 788.7, 870.7, 961.2, 1061.2, 1171.5, 1293.4, 1427.8, 1576.4, 1740.4, 1921.4, 2121.2, 2342, 2585.6, 2854.6, 3151.6, 3479.5, 3841.6, 4241.3, 4682.6, 5169.9, 5707.9, 6301.9, 6957.6, 7681.8, 8481.2, 9363.8, 10338.3, 11414.3, 12602.2, 13913.8, 15361.9, 16960.8, 18726, 20675, 22826.9, 25202.7, 27825.9, 30722.1, 33919.8, 37450.2, 41348.2, 45651.9, 50403.7, 55649.9, 61442.2, 67837.6, 74898.5, 82694.4, 91301.9, 100805.2, 111297.7, 122882.5, 135672.9, 149794.8, 165386.8, 182601.5, 201608.1, 222593.3, 245762.6, 271343.7, 299587.4, 330771.1, 365200.7, 403213.9, 445184, 491522.9, 542684.9, 599172.5, 661539.7, 730398.8, 806425.4, 890365.5, 983043, 9572683.4};
double[] normalTime = new double[] {1.00958241758242, 1.11495970695971, 1.06963166953528, 1.18127672595142, 1.15018594104308, 1.27023901906442, 1.2472594878124, 1.37744482155713, 1.41685187507839, 1.56473877113034, 1.56755170743479, 1.73116821561822, 1.74434730120433, 1.92641722153205, 1.95725417087426, 2.16154669376012, 2.21124718747179, 2.44205076596211, 2.50994901343847, 2.77193022359534, 2.86812333250013, 3.1674897409429, 3.29805772944222, 3.64229944530993, 3.80841107155634, 4.20592199148309, 4.42242809498221, 4.8840283338524, 5.15065412806684, 5.68826449160243, 6.02144053611861, 6.64994106345759, 7.05825151342297, 7.79497136835937, 8.29491528158907, 9.16071451973473, 9.77092350100014, 10.7907842031247, 11.311355104669, 12.4920015970756, 13.4631737052244, 14.8684207923017, 15.322810010546, 16.9221605503673, 17.602791084445, 19.4401194467945, 19.9138619998677, 21.9924132523791, 16.9295074753534, 18.6965604441613, 19.4662745138955, 21.4981078806657, 22.4508340041317, 24.794187048334, 21.9299806848883, 24.2189685678228, 25.3352524716474, 27.9796727633009, 24.6417064586782, 27.2137364257457, 27.7930719891776, 30.6940323651524, 30.0742869561431, 33.2133539448314, 33.3534941382039, 36.8348352772083, 37.0696258402337, 40.93884604578, 42.4260461563957, 46.8543540043697, 47.1239377238921, 52.0425978903589, 53.693321666918, 59.2976751068993, 60.1692757457264, 66.4495705205329, 66.7720718040988, 73.7415473122707, 76.8324023748064, 84.8519460570252, 88.1453522545292, 97.3457088871568, 101.175803906389, 111.736241351164, 116.429000968713, 128.581522955346, 133.995020100622, 147.981032299676, 154.311116147988, 170.417663624714, 178.555672255407, 197.192796295533, 207.556928886271, 229.221120116824, 239.701753082987, 264.721127983905, 278.790936846473, 307.890327561088, 325.297010290488, 359.250570287139, 376.451809570906, 415.744759391439, 439.247661643271, 485.09506067001, 506.047490207454, 558.867261912609, 590.119126007236, 651.714051617419, 691.908460702742, 764.127862324914, 796.957117808243, 880.14119407779, 939.928811085602, 1038.03585870733, 1082.69792300564, 1195.70679712407, 1262.42094024116, 1394.18878248856, 1488.70556306347, 14496.7280485445};

double[] secondCost = new double[] {205.809139511126, 205.666898683103, 205.510947895753, 205.361245312921, 205.196866006281, 205.037961182368, 204.861115491238, 204.68980138365, 204.499200257327, 204.304466121548, 204.089732263715, 203.875511955396, 203.639490465256, 203.403440451273, 203.141545545247, 202.877319302118, 202.586276067149, 202.289821292416, 201.962849114402, 201.628401442031, 201.259634189599, 200.884128316807, 200.470823998073, 200.047463215808, 199.579870710024, 199.098934496811, 198.568726422112, 198.019767421347, 197.414106074069, 196.785167022266, 196.091067618249, 195.36729726347, 194.568607981024, 193.733220320596, 192.811209255825, 191.843868432443, 190.776540948612, 189.653863969407, 188.414520387594, 187.116029983754, 185.682824831642, 184.156548244533, 182.471970368444, 180.744867551454, 178.837898847873, 176.892146461388, 174.744031015699, 172.563340671575, 170.155927101612, 168.448060074772, 166.562512333528, 164.653461422647, 162.545764924027, 160.406844613766, 158.045313603054, 156.136045952524, 153.988235498788, 151.784760223372, 149.351920748064, 147.503584655442, 145.462951839076, 143.506325452791, 141.346126978658, 139.472520504396, 137.403974289463, 135.544562182586, 133.491648277631, 131.713718729864, 129.75076664292, 127.774684202822, 125.573085489923, 123.762314431261, 121.763104645016, 120.117322794866, 118.300249603707, 116.783640524603, 114.939775999494, 113.850096472748, 112.647000728262, 110.627734605662, 107.826828419619, 105.60890512289, 103.160142677246, 101.141235060418, 98.3943606030692, 96.4191212414268, 94.1197186833565, 91.9810632039793, 89.6198071860878, 88.0967551101201, 85.6040436484927, 84.3265101874514, 82.221926362036, 80.9960672634902, 79.5357439871363, 78.2995243514211, 76.9346308757958, 75.9839103477244, 74.468989411611, 73.7032366599374, 71.4184976232158, 71.2078468065862, 68.9970151203599, 69.3621460275368, 65.7648099340712, 65.7648099340712, 63.4054359144346, 63.4054359144346, 61.4267301448194, 61.4267301448194, 58.4295546509364, 58.4295546509364, 56.8818318948696, 56.8818318948696, 54.0605778240308, 54.0605778240308, 51.9881981076397, 51.9881981076397, 50.5389169106641, 50.5389169106641};
double[] secondCost2 = new double[] {203.13233860099, 202.988993482163, 202.83183196634, 202.680772303242, 202.514902869252, 202.354348261486, 202.175666520585, 202.002343402015, 201.809507084666, 201.612311577817, 201.394863559453, 201.177636387015, 200.938302024462, 200.698606520352, 200.432666982947, 200.163983662474, 199.868030990072, 199.566147894276, 199.233188597443, 198.892128484954, 198.51607025227, 198.132501726134, 197.710323166839, 197.277156814418, 196.798734275924, 196.30585043449, 195.762470698387, 195.198956346536, 194.577236216113, 193.930575292604, 193.216917967109, 192.471554070454, 191.649036055106, 190.787344985998, 189.836303047305, 188.836911181175, 187.734219782183, 186.572493483566, 185.290042646251, 183.943974604858, 182.458255768343, 180.873997261643, 179.125423737726, 177.327672918664, 175.342698709217, 173.310851554106, 171.067687270979, 168.782062691008, 166.25880502424, 164.423053139412, 162.396315831693, 160.331400260874, 158.051620662669, 155.722735724616, 153.151469289297, 151.01064649224, 148.624436411962, 146.173777319575, 143.468024163638, 141.318387638638, 138.945107771579, 136.62122487126, 134.055559637202, 131.734290824981, 129.171505159301, 126.76642883342, 124.111065552939, 121.667993393022, 118.970679767243, 116.273634388718, 113.283811160463, 110.60278967096, 107.642766440354, 104.936178332934, 101.947891222429, 99.2288303248363, 96.1192999109482, 93.6322283836829, 90.8862970366724, 89.6688583891789, 87.9450600565222, 86.5393226499183, 84.9872775567425, 83.6651681411018, 81.8487685186973, 80.5094726227178, 78.954690408184, 77.4707819037332, 75.832421765823, 74.7640388864952, 73.0098766187729, 72.104918422045, 70.6542197712317, 69.8567106080253, 68.9065542546254, 68.1010156606756, 67.2116313316438, 66.574684853225, 65.5597456288688, 64.9942472119106, 63.3069972404224, 63.1531374790764, 61.538341766146, 61.8270638283787, 58.9825215696044, 58.9825215696044, 57.1539933435418, 57.1539933435418, 55.6254649227186, 55.6254649227186, 53.1343762606953, 53.1343762606953, 51.9271669220486, 51.9271669220486, 49.5277421737892, 49.5277421737892, 47.7862534445361, 47.7862534445361, 46.596228808774, 46.596228808774};
double[] reachLevel = new double[] {80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120};
double[] secondTime = new double[] {24.9946429257347, 24.9783842111745, 24.9604239225849, 24.9432943332101, 24.9243723855536, 24.9060506888359, 24.8858238572065, 24.8660689282208, 24.8442605111923, 24.8219115774579, 24.797227808174, 24.7726476204672, 24.7454977940721, 24.718299297897, 24.6882714810255, 24.6579417322399, 24.624439643112, 24.5903759437907, 24.5527527673272, 24.5143193989011, 24.4718684795311, 24.4282110190991, 24.3799813137437, 24.3300542238567, 24.2749163955096, 24.2175845383904, 24.1542567117313, 24.0880317336631, 24.0148862553222, 23.9381519219767, 23.8534012345939, 23.7641440208121, 23.6655607949053, 23.5614444982819, 23.4464515869104, 23.3246787903348, 23.1901789836552, 23.0474035039304, 22.8897163219235, 22.7256509515522, 22.544445507274, 22.3498647994608, 22.1349546550305, 21.9158909898917, 21.6739535964416, 21.4248306343984, 21.1496883589048, 20.8717319487254, 20.5647412156741, 20.3483217811742, 20.1092907297184, 19.8649748206746, 19.595132087265, 19.3186025584435, 19.0131802946162, 18.7667111995194, 18.490451007457, 18.2047319219977, 17.8891513821645, 17.6448833971303, 17.3750629489418, 17.1147038849072, 16.8271013961493, 16.5731352612704, 16.2923706355883, 16.0378836320328, 15.7567402789638, 15.5063131557712, 15.2296329829085, 14.9463360163191, 14.6310161166959, 14.3596539672288, 14.0595718337876, 13.7912768736783, 13.4947912766823, 13.2295985529344, 12.9181982399467, 12.684004188419, 12.425408200958, 12.212164466137, 11.9147945189033, 11.678465792127, 11.4174452967627, 11.202029099851, 10.9072154065515, 10.6977333721524, 10.4482346235909, 10.2179425784472, 9.96261811883693, 9.79890600858667, 9.5292281368228, 9.39100021700554, 9.13546626658899, 8.95336286950375, 8.73661022043875, 8.5538243186338, 8.35021455477117, 8.21361702837751, 7.99254171400577, 7.89238136322017, 7.58748131883126, 7.5609402291254, 7.26239303170813, 7.30945047798586, 6.86457666518511, 6.86457666518511, 6.56680908628267, 6.56680908628267, 6.31619233951591, 6.31619233951591, 5.96806504391798, 5.96806504391798, 5.77411467139106, 5.77411467139106, 5.456191060476, 5.456191060476, 5.21889040213051, 5.21889040213051, 5.04794996442499, 5.04794996442499};

private static final long serialVersionUID = 1L;

JPanel x = new JPanel() {
    public void paintComponent(Graphics g) {
        super.paintComponent(g);

        Image oi = getImage(getCodeBase(), "Logo.png");

        g.drawImage(oi, 0, 200, 537, 93, null);

    }
};

public void init() {

    t.setBounds(25, 25, 220, 25);
    t.setSelected(true);
    t.addActionListener(this);
    t.setBackground(Color.WHITE);

    z.setBounds(250, 25, 150, 25);
    z.addActionListener(this);
    z.setBackground(Color.WHITE);

    ButtonGroup group = new ButtonGroup();
    group.add(t);
    group.add(z);

    leech.setBounds(30, 100, 160, 25);
    leech.setOpaque(true);
    leech.setBackground(Color.WHITE);

    t2.setBounds(30, 125, 50, 25);
    t2.setSelected(true);
    t2.addActionListener(this);
    t2.setBackground(Color.WHITE);

    z2.setBounds(85, 125, 50, 25);
    z2.addActionListener(this);
    z2.setBackground(Color.WHITE);

    ButtonGroup group2 = new ButtonGroup();
    group2.add(t2);
    group2.add(z2);

    p.setBounds(30, 50, 160, 25);
    p.setBackground(Color.WHITE);
    p.setOpaque(true);

    e.setBounds(195, 50, 150, 25);
    e.setBackground(Color.WHITE);
    e.setOpaque(true);

    startLevel.setBounds(30, 75, 150, 25);
    startLevel.setBackground(Color.WHITE);
    startLevel.setText("1");

    endLevel.setBounds(195, 75, 150, 25);
    endLevel.setBackground(Color.WHITE);
    endLevel.setText("1");

    cost.setBounds(225, 100, 150, 25);
    cost.setBackground(Color.WHITE);
    cost.setOpaque(true);

    chaotics.setBounds(225, 120, 160, 25);
    chaotics.setBackground(Color.WHITE);
    chaotics.setOpaque(true);

    time.setBounds(225, 140, 150, 25);
    time.setBackground(Color.WHITE);
    time.setOpaque(true);

    calc.setBounds(155, 175, 90, 25);
    calc.setBackground(Color.WHITE);
    calc.addActionListener(this);

    x.setBounds(0, 0, 400, 293);
    x.setVisible(true);
    x.setLayout(null);
    x.setBackground(Color.WHITE);

    x.add(t);
    x.add(z);
    x.add(startLevel);
    x.add(endLevel);
    x.add(p);
    x.add(e);
    x.add(cost);
    x.add(chaotics);
    x.add(time);
    x.add(calc);
    x.add(t2);
    x.add(z2);
    x.add(leech);

    this.add(x);

    endLevel.setVisible(false);
    e.setVisible(false);

    calc.doClick();

    this.setSize(400, 293);
    this.setVisible(true);

}

public static double round(double value, int places) {
    if (places < 0) throw new IllegalArgumentException();

    long factor = (long) Math.pow(10, places);
    value = value * factor;
    long tmp = Math.round(value);
    return (double) tmp / factor;
}


@Override
public void actionPerformed(ActionEvent arg0) {

    if(t.isSelected()) {

        endLevel.setVisible(false);
        e.setVisible(false);

        if(startLevel.getText().length() < 1) {

        } else {

            double cost1 = 0;
            double chaotic = 0;
            double time = 0;


            for(int i = 0; i <= normalCost.length; i++) {
                if(Integer.parseInt(startLevel.getText()) == i) {
                    if(z2.isSelected()){
                        cost1 = secondCost2[i - 1];
                    } else {
                        cost1 = secondCost[i - 1];
                    }
                    time = secondTime[i - 1];
                    chaotic = reachLevel[i - 1];
                }
            }

            cost.setText("It will cost: " + round(cost1, 2) + "m");
            chaotics.setText("You will reach level: " + round(chaotic, 2));
            this.time.setText("It will take: " + round(time, 2) + " hours");

        }

        x.repaint();

    } else if(z.isSelected()) {

        endLevel.setVisible(true);
        e.setVisible(true);

        if((startLevel.getText().length() < 1) || (endLevel.getText().length() < 1)) {

        } else {

            double cost1 = 0;
            double chaotic = 0;
            double time = 0;

            for(int i = 0; i <= normalCost.length; i++) {
                if(!((Integer.parseInt(startLevel.getText())) >= (i))) {
                    if(!(Integer.parseInt(endLevel.getText()) < (i))) {
                        if(z2.isSelected()){
                            cost1 = cost1 + normalCost2[i - 2];
                        } else {
                            cost1 = cost1 + normalCost[i - 2];
                        }
                        chaotic = chaotic + normalTokens[i - 2];
                        time = time + normalTime[i - 2];
                    }
                }
            }

            cost.setText("It will cost: " + round(cost1, 2) + "m");
            chaotics.setText("You will gain: " + round(chaotic / 200000, 2) + " chaotics");
            this.time.setText("It will take: " + round(time / 60, 2) + " hours");

        }

        x.repaint();
    }

}

}

为了澄清一些,这适用于其他人。据我所知,他是唯一一个有问题的人。

4

1 回答 1

0

您的问题是 Mac、Windows 和 Linux 显示 Swing 组件的方式不同。如果您希望它在所有操作系统上看起来都一样,则必须使用非默认 L&F。

由于 GUI 的外观,我已经可以看到有问题的人在 Mac OSX 上。

于 2012-07-20T18:08:11.760 回答