小编Ass*_*ino的帖子

获取本地主机IP地址

public static string GetLocalIpAddress()
    {
        string hostName = Dns.GetHostName();
        IPHostEntry ip = Dns.GetHostEntry(hostName);
        string IpAddress = Convert.ToString(ip.AddressList[2]);
        return IpAddress.ToString();
    }
Run Code Online (Sandbox Code Playgroud)

这有时会显示索引超出范围的异常应该是什么问题.提前致谢

c# ip

1
推荐指数
1
解决办法
2万
查看次数

当我按1时文本字段应显示1但它没有.为什么?

public class Scal {

    JFrame mainframe;
    JPanel controlsPanel;
    JPanel inputPanel;
    JPanel opPanel;
    JTextField inputbox;
    String input1 = "";

    public Scal(){
        prepareCAL();
    }

    public static void main(String[] args) {
        Scal cal = new Scal();
        cal.showcontrols();
    }

    private void prepareCAL() {
        mainframe = new JFrame();
        mainframe.setSize(400, 400);
        mainframe.setBackground(Color.GRAY);        

        inputPanel = new JPanel(); 
        controlsPanel = new JPanel();
        controlsPanel.setSize(new Dimension(200, 250));

        opPanel = new JPanel();
        opPanel.setSize(200, 250);
//      opPanel.setMaximumSize(new Dimension(200, 250));

        mainframe.add(inputPanel, BorderLayout.NORTH);
        mainframe.add(controlsPanel, BorderLayout.CENTER);
        mainframe.add(opPanel, BorderLayout.EAST);
        mainframe.setVisible(true);
    }

    private void showcontrols() {
        inputbox …
Run Code Online (Sandbox Code Playgroud)

java swing awt

0
推荐指数
1
解决办法
86
查看次数

标签 统计

awt ×1

c# ×1

ip ×1

java ×1

swing ×1