Java GridBagLayout自动化构建

2023-12-11

我使用 GridBagLayout 和 GridBagConstraints 设计了一个 GUI。它包含可变数量的行,每行都有几种可能的列布局之一。为了测试代码,我使用了不同颜色的面板 GUI 来说明每行和每列中所有单元格的位置和调整大小行为。这个测试 GUI 工作正常,但现在我需要自动化它的构建。具体来说,我需要这些行是三种不同类型之一。如果运行下面的代码并查看生成的 GUI,您可以看到 row1 是一种类型,行 2,6 和 7 是另一种类型,行 3,4 和 5 是第三种类型。我需要将这三种类型的行封装在自己的类中。更重要的是,我需要我的代码能够创建第三种类型的可变数量的行(如示例中的第 3、4 和 5 行所示)。 (这是用于数据分析软件的。面板将加载数据视图和用于操作数据视图的工具。)

当我尝试将行封装到它们自己的类中时,GUI 看起来不再像它应该的那样。下面的测试代码生成一个应有的 GUI 布局。谁能告诉我如何更改此代码,使其具有上面第一段中描述的功能?

您只需将下面的测试代码粘贴到您的 IDE 中即可立即运行。测试代码位于两个单独的文件中,如下:

GridBagLayoutDemo.java 的代码是:

import java.awt.*;
import javax.swing.JFrame;

public class GridBagLayoutDemo {
    final static boolean RIGHT_TO_LEFT = false;

    public static void addComponentsToPane(Container pane) {
        if (RIGHT_TO_LEFT) {pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);}
        pane.setLayout(new GridBagLayout());

// top row (fill, gridx, gridy, gridwidth 1, weightx 0, weighty 0, ipady 0)
        TestPanel panelr1c1 = new TestPanel(Color.black);
        GridBagConstraints constraint_r1c1 = getGridBagConstraints(GridBagConstraints.NONE,0,0,1,0,0,0);
        pane.add(panelr1c1,constraint_r1c1);

        TestPanel panelr1c2 = new TestPanel(Color.blue);
        GridBagConstraints constraint_r1c2 = getGridBagConstraints(GridBagConstraints.HORIZONTAL,1,0,1,0.8,0,0);
        pane.add(panelr1c2,constraint_r1c2);

        TestPanel panelr1c2a = new TestPanel(Color.green);
        GridBagConstraints constraint_r1c2a = getGridBagConstraints(GridBagConstraints.HORIZONTAL,2,0,1,0.8,0,0);
        pane.add(panelr1c2a,constraint_r1c2a);

        TestPanel panelr1c3 = new TestPanel(Color.red);
        GridBagConstraints constraint_r1c3 = getGridBagConstraints(GridBagConstraints.NONE,3,0,1,0,0,0);
        pane.add(panelr1c3,constraint_r1c3);

        TestPanel panelr1c4 = new TestPanel(Color.blue);
        GridBagConstraints constraint_r1c4 = getGridBagConstraints(GridBagConstraints.NONE,4,0,1,0,0,0);
        pane.add(panelr1c4,constraint_r1c4);

// second row (fill, gridx, gridy, gridwidth 1, weightx 0, weighty 0, ipady 0)
        TestPanel panelr2c1 = new TestPanel(Color.magenta);
        GridBagConstraints constraint_r2c1 = getGridBagConstraints(GridBagConstraints.NONE,0,1,1,0,0,0);
        pane.add(panelr2c1,constraint_r2c1);

        TestPanel panelr2c2 = new TestPanel(Color.pink);
        GridBagConstraints constraint_r2c2 = getGridBagConstraints(GridBagConstraints.HORIZONTAL,1,1,2,1.0,0,0);
        pane.add(panelr2c2,constraint_r2c2);

        TestPanel panelr2c3 = new TestPanel(Color.black);
        GridBagConstraints constraint_r2c3 = getGridBagConstraints(GridBagConstraints.NONE,3,1,1,0,0,0);
        pane.add(panelr2c3,constraint_r2c3);

        TestPanel panelr2c4 = new TestPanel(Color.pink);
        GridBagConstraints constraint_r2c4 = getGridBagConstraints(GridBagConstraints.NONE,4,1,1,0,0,0);
        pane.add(panelr2c4,constraint_r2c4);

// third row (fill, gridx, gridy, gridwidth 1, weightx 0, weighty 0, ipady 0)
        TestPanel panelr3c1 = new TestPanel(Color.gray);
        GridBagConstraints constraint_r3c1 = getGridBagConstraints(GridBagConstraints.VERTICAL,0,2,1,0,0.5,40);
        pane.add(panelr3c1,constraint_r3c1);

        TestPanel panelr3c2 = new TestPanel(Color.orange);
        GridBagConstraints constraint_r3c2 = getGridBagConstraints(GridBagConstraints.BOTH,1,2,2,1.0,0.5,40);
        pane.add(panelr3c2,constraint_r3c2);

        TestPanel panelr3c3 = new TestPanel(Color.red);
        GridBagConstraints constraint_r3c3 = getGridBagConstraints(GridBagConstraints.VERTICAL,3,2,1,0,0.5,40);
        pane.add(panelr3c3,constraint_r3c3);

        TestPanel panelr3c4 = new TestPanel(Color.orange);
        GridBagConstraints constraint_r3c4 = getGridBagConstraints(GridBagConstraints.VERTICAL,4,2,1,0,0.5,40);
        pane.add(panelr3c4,constraint_r3c4);

// fourth row (fill, gridx, gridy, gridwidth 1, weightx 0, weighty 0, ipady 0)
        TestPanel panelr4c1 = new TestPanel(Color.black);
        GridBagConstraints constraint_r4c1 = getGridBagConstraints(GridBagConstraints.VERTICAL,0,3,1,0,0.5,40);
        pane.add(panelr4c1,constraint_r4c1);

        TestPanel panelr4c2 = new TestPanel(Color.white);
        GridBagConstraints constraint_r4c2 = getGridBagConstraints(GridBagConstraints.BOTH,1,3,2,1.0,0.5,40);
        pane.add(panelr4c2,constraint_r4c2);

        TestPanel panelr4c3 = new TestPanel(Color.green);
        GridBagConstraints constraint_r4c3 = getGridBagConstraints(GridBagConstraints.VERTICAL,3,3,1,0,0.5,40);
        pane.add(panelr4c3,constraint_r4c3);

        TestPanel panelr4c4 = new TestPanel(Color.blue);
        GridBagConstraints constraint_r4c4 = getGridBagConstraints(GridBagConstraints.VERTICAL,4,3,1,0,0.5,40);
        pane.add(panelr4c4,constraint_r4c4);

// fifth row (fill, gridx, gridy, gridwidth 1, weightx 0, weighty 0, ipady 0)
        TestPanel panelr5c1 = new TestPanel(Color.darkGray);
        GridBagConstraints constraint_r5c1 = getGridBagConstraints(GridBagConstraints.VERTICAL,0,4,1,0,0.5,40);
        pane.add(panelr5c1,constraint_r5c1);

        TestPanel panelr5c2 = new TestPanel(Color.yellow);
        GridBagConstraints constraint_r5c2 = getGridBagConstraints(GridBagConstraints.BOTH,1,4,2,1.0,0.5,40);
        pane.add(panelr5c2,constraint_r5c2);

        TestPanel panelr5c3 = new TestPanel(Color.white);
        GridBagConstraints constraint_r5c3 = getGridBagConstraints(GridBagConstraints.VERTICAL,3,4,1,0,0.5,40);
        pane.add(panelr5c3,constraint_r5c3);

        TestPanel panelr5c4 = new TestPanel(Color.orange);
        GridBagConstraints constraint_r5c4 = getGridBagConstraints(GridBagConstraints.VERTICAL,4,4,1,0,0.5,40);
        pane.add(panelr5c4,constraint_r5c4);

// sixth row (fill, gridx, gridy, gridwidth 1, weightx 0, weighty 0, ipady 0)
        TestPanel panelr6c1 = new TestPanel(Color.green);
        GridBagConstraints constraint_r6c1 = getGridBagConstraints(GridBagConstraints.NONE,0,5,1,0,0,0);
        pane.add(panelr6c1,constraint_r6c1);

        TestPanel panelr6c2 = new TestPanel(Color.blue);
        GridBagConstraints constraint_r6c2 = getGridBagConstraints(GridBagConstraints.HORIZONTAL,1,5,2,1.0,0,0);
        pane.add(panelr6c2,constraint_r6c2);

        TestPanel panelr6c3 = new TestPanel(Color.red);
        GridBagConstraints constraint_r6c3 = getGridBagConstraints(GridBagConstraints.NONE,3,5,1,0,0,0);
        pane.add(panelr6c3,constraint_r6c3);

        TestPanel panelr6c4 = new TestPanel(Color.black);
        GridBagConstraints constraint_r6c4 = getGridBagConstraints(GridBagConstraints.NONE,4,5,1,0,0,0);
        pane.add(panelr6c4,constraint_r6c4);

// seventh row (fill, gridx, gridy, gridwidth 1, weightx 0, weighty 0, ipady 0)
        TestPanel panelr7c1 = new TestPanel(Color.darkGray);
        GridBagConstraints constraint_r7c1 = getGridBagConstraints(GridBagConstraints.NONE,0,6,1,0,0,0);
        pane.add(panelr7c1,constraint_r7c1);

        TestPanel panelr7c2 = new TestPanel(Color.white);
        GridBagConstraints constraint_r7c2 = getGridBagConstraints(GridBagConstraints.HORIZONTAL,1,6,2,1.0,0,0);
        pane.add(panelr7c2,constraint_r7c2);

        TestPanel panelr7c3 = new TestPanel(Color.yellow);
        GridBagConstraints constraint_r7c3 = getGridBagConstraints(GridBagConstraints.NONE,3,6,1,0,0,0);
        pane.add(panelr7c3,constraint_r7c3);

        TestPanel panelr7c4 = new TestPanel(Color.green);
        GridBagConstraints constraint_r7c4 = getGridBagConstraints(GridBagConstraints.NONE,4,6,1,0,0,0);
        pane.add(panelr7c4,constraint_r7c4);
    }

    // Create the GUI and show it.  For thread safety, this method should be invoked from the event-dispatching thread.
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("GridBagConstraint Practice");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Set up the content pane.
        addComponentsToPane(frame.getContentPane());
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread: creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() {createAndShowGUI();}});
    }
    private static GridBagConstraints getGridBagConstraints(int fill, int gridx, int gridy, int gridwidth, double weightx, double weighty, int ipady){
        GridBagConstraints myGridBagConstraints = new GridBagConstraints();
          myGridBagConstraints.fill=fill;
        myGridBagConstraints.gridx=gridx;
        myGridBagConstraints.gridy=gridy;
        myGridBagConstraints.gridwidth=gridwidth;
        myGridBagConstraints.weightx=weightx;
        myGridBagConstraints.weighty=weighty;
        myGridBagConstraints.ipady=ipady;
        return myGridBagConstraints;
    }
}

TestPanel.java的代码是:

import java.awt.Color;
import javax.swing.JPanel;

public class TestPanel extends JPanel {
    public TestPanel (Color myColor){this.setBackground(myColor);}
}

Swing 布局的规则 1:无论你做什么,都不要使用 GridBagLayout。 GridBagLayout 在 1998 年还不错。它的设计有问题,有 bug,而且还没有进化。代码极其冗长、难以编写、难以理解且难以维护。

我建议米格布局,它是我见过的最通用、最直观的布局管理器。看看MigLayout网站上的快速入门指南,它比GridBagLayout难度低很多,而且功能强大得多。这是 MigLayout 中的示例,我向您展示了如何重构行类型:

import net.miginfocom.swing.MigLayout;
import java.awt.*;
import javax.swing.*;

public class GridBagLayoutDemo {
    final static boolean RIGHT_TO_LEFT = false;

    public static void addComponentsToPane(Container pane) {
        if (RIGHT_TO_LEFT) {
            pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        }
        pane.setLayout(new MigLayout("insets 0, gap 0, wrap", "[][fill, grow][fill, grow][][]", "[fill]"));

        addType1(pane, Color.BLACK, Color.BLUE, Color.GREEN, Color.RED, Color.BLUE);
        addType2(pane, Color.MAGENTA, Color.PINK, Color.BLACK, Color.PINK);
        addType3(pane, Color.GRAY, Color.ORANGE, Color.RED, Color.ORANGE);
        addType3(pane, Color.BLACK, Color.WHITE, Color.GREEN, Color.BLUE);
        addType3(pane, Color.DARK_GRAY, Color.YELLOW, Color.WHITE, Color.ORANGE);
        addType2(pane, Color.GREEN, Color.BLUE, Color.RED, Color.BLACK);
        addType2(pane, Color.DARK_GRAY, Color.WHITE, Color.YELLOW, Color.GREEN);
    }

    private static void addType1(Container pane, Color c1, Color c2, Color c3, Color c4, Color c5) {
        pane.add(new TestPanel(c1));
        pane.add(new TestPanel(c2));
        pane.add(new TestPanel(c3));
        pane.add(new TestPanel(c4));
        pane.add(new TestPanel(c5));
    }

    private static void addType2(Container pane, Color c1, Color c2, Color c3, Color c4) {
        pane.add(new TestPanel(c1));
        pane.add(new TestPanel(c2), "spanx 2");
        pane.add(new TestPanel(c3));
        pane.add(new TestPanel(c4));
    }

    private static void addType3(Container pane, Color c1, Color c2, Color c3, Color c4) {
        pane.add(new TestPanel(c1));
        pane.add(new TestPanel(c2), "spanx 2, pushy, hmin pref+40");
        pane.add(new TestPanel(c3));
        pane.add(new TestPanel(c4));
    }

    private static void createAndShowGUI() {
        JFrame frame = new JFrame("MigLayout Practice");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        addComponentsToPane(frame.getContentPane());
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}

class TestPanel extends JPanel {
    public TestPanel(Color myColor) {
        this.setBackground(myColor);
    }
}

这会产生与您的示例完全相同的布局。也许你想要hmin 40代替hmin pref+40,后者产生的结果与在 GridBagConstraints 中设置 ipady=40 相同。

并且请在 Color 类中使用大写常量,小写常量确实应该被弃用。

对于任何想知道这个布局是什么样子的人,这里是:

enter image description here

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Java GridBagLayout自动化构建 的相关文章

  • SAML 服务提供商 Spring Security

    当使用预先配置的服务提供者元数据时 在 Spring Security 中 是否应该有 2 个用于扩展元数据委托的 bean 定义 一份用于 IDP 元数据 一份用于 SP 元数据
  • Android在排序列表时忽略大小写

    我有一个名为路径的列表 我目前正在使用以下代码对字符串进行排序 java util Collections sort path 这工作正常 它对我的 列表进行排序 但是它以不同的方式处理第一个字母的情况 即它用大写字母对列表进行排序 然后用
  • 比较两个文本文件的最快方法是什么,不将移动的行视为不同

    我有两个文件非常大 每个文件有 50000 行 我需要比较这两个文件并识别更改 然而 问题是如果一条线出现在不同的位置 它不应该显示为不同的 例如 考虑这个文件A txt xxxxx yyyyy zzzzz 文件B txt zzzzz xx
  • 运行具有外部依赖项的 Scala 脚本

    我在 Users joe scala lib 下有以下 jar commons codec 1 4 jar httpclient 4 1 1 jar httpcore 4 1 jar commons logging 1 1 1 jar ht
  • 如何安全地解决这个 Java 上下文类加载器问题?

    我的数百名用户中只有一位在启动我的 Java 桌面应用程序时遇到问题 他只有大约三分之一的时间开始 另外三分之二的时间在启动时抛出 NullPointerException Exception in thread AWT EventQueu
  • 使用 AES SecretKey 的 Java KeyStore setEntry()

    我目前正在 Java 中开发一个密钥处理类 特别是使用 KeyStore 我正在尝试使用 AES 实例生成 SecretKey 然后使用 setEntry 方法将其放入 KeyStore 中 我已经包含了代码的相关部分 The KS Obj
  • Java 文件上传速度非常慢

    我构建了一个小型服务 它从 Android 设备接收图像并将其保存到 Amazon S3 存储桶中 代码非常简单 但是速度非常慢 事情是这样的 public synchronized static Response postCommentP
  • 在 Netbeans 8 上配置 JBoss EAP 的问题

    我已经下载了 JBoss EAP 7 并正在 Netbeans 8 上配置它 我已经到达向导 实例属性 其中要求从选择框中选择 域 当我打开选择框时 它是空的 没有什么可以选择的 因此 完成 按钮也处于非活动状态 这使得无法完成配置 我通过
  • Java 8 流 - 合并共享相同 ID 的对象集合

    我有一系列发票 class Invoice int month BigDecimal amount 我想合并这些发票 这样我每个月都会收到一张发票 金额是本月发票金额的总和 例如 invoice 1 month 1 amount 1000
  • 很好地处理数据库约束错误

    再一次 它应该很简单 我的任务是在我们的应用程序的域对象中放置一个具有唯一约束的特定字段 这本身并不是一个很大的挑战 我刚刚做了以下事情 public class Location more fields Column unique tru
  • 以编程方式在java的resources/source文件夹中创建文件?

    我有两个资源文件夹 src 这是我的 java 文件 资源 这是我的资源文件 图像 properties 组织在文件夹 包 中 有没有办法以编程方式在该资源文件夹中添加另一个 properties 文件 我尝试过这样的事情 public s
  • react-native run-android 失败并出现错误:任务 ':app:dexDebug' 执行失败

    我使用的是 Windows 8 1 和react native cli 1 0 0 and react native 0 31 0 添加后react native maps对于该项目 我运行了命令react native upgrade并给
  • Java整数双除法混淆[重复]

    这个问题在这里已经有答案了 方案1 int sum 30 double avg sum 4 result is 7 0 not 7 5 VS 方案2 int sum 30 double avg sum 4 0 Prints lns 7 5
  • 如何知道抛出了哪个异常

    我正在对我们的代码库进行审查 有很多这样的陈述 try doSomething catch Exception e 但我想要一种方法来知道 doSomething 抛出了哪个异常 在 doSomething 的实现中没有 throw 语句
  • 测试弱引用

    在 Java 中测试弱引用的正确方法是什么 我最初的想法是执行以下操作 public class WeakReferenceTest public class Target private String value public Targe
  • 将 Azure AD 高级自定义角色与 Spring Security 结合使用以进行基于角色的访问

    我创建了一个演示 Spring Boot 应用程序 我想在其中使用 AD 身份验证和授权 并使用 AD 和 Spring Security 查看 Azure 文档 我执行了以下操作 package com myapp contactdb c
  • Java中的Object类是什么?

    什么是或什么类型private Object obj Object http download oracle com javase 6 docs api java lang Object html是Java继承层次结构中每个类的最终祖先 从
  • javafx android 中的文本字段和组合框问题

    我在简单的 javafx android 应用程序中遇到问题 问题是我使用 gradle javafxmobile plugin 在 netbeans ide 中构建了非常简单的应用程序 其中包含一些文本字段和组合框 我在 android
  • 为什么C++代码执行速度比java慢?

    我最近用 Java 编写了一个计算密集型算法 然后将其翻译为 C 令我惊讶的是 C 的执行速度要慢得多 我现在已经编写了一个更短的 Java 测试程序和一个相应的 C 程序 见下文 我的原始代码具有大量数组访问功能 测试代码也是如此 C 的
  • hashcode 的默认实现为以相同方式构造的对象返回不同的值

    我在这里编写一个示例代码 public class Test private int i private int j public Test TODO Auto generated constructor stub public Test

随机推荐

  • Prolific PL2303 串行端口至 250000bps

    我需要使用 c 以 250kbps 的速度运行我的 dev ttyUSB0 多产的 pl2303 USB RS232 转换器 我到处查看 每个人都说最接近的可达到的速度是 230400 bps http lxr linux no linux
  • 通用量化和统一,一个例子

    给出运行 monad 的以下签名ST runST forall s ST s a gt a 和功能 newVar a gt ST s MutVar s a readVar MutVar s a gt ST s a 那么Haskell编译器将
  • Facebook API for Android:如何获取有关用户好友的扩展信息?

    我正在开发小型 Android 应用程序 试图添加 Facebook 支持 主要问题 我只能获取有关用户朋友的基本信息 ID 姓名 应用程序权限列表 offline access仅用于测试 很快就会被删除 String sPermissio
  • 我如何使用 ruby​​ 迭代这个 json 文档?

    我有一个ruby代码块 如下 require elasticsearch require json search term big data city Hong Kong client Elasticsearch Client new lo
  • 使用 Maven 集成 Activiti Modeler

    如何将 Activiti Modeler 集成到自己的 Web 应用程序中并保留 Maven 建议的所有优点 问题是Maven中的Activiti Modeler是Activiti Explorer的一部分 网上有一些问题来自那些想要开发自
  • 如何在 Array.map 中获得正确的“this”?

    我假设有一些应用call or apply在这里 但我不确定如何实现它 http codepen io anon pen oXmmzo a foo bar things 1 2 3 showFooForEach function this
  • 如何在图中找到精确长度的路径

    我想在无向图中找到固定长度的路径 运行程序时给出 我正在使用我的图的邻接矩阵 我尝试使用一些算法 如 DFS 或 A 但它们只返回最短路径 节点无法再次访问 假设我的图有 9 个节点 最短路径是由 4 个节点构建的 我想要有额外的变量来 告
  • 使用Python从word文档中提取图像

    如何使用 python 从 Word 文档中提取图像 徽标并将其存储在文件夹中 以下代码将 docx 转换为 html 但不会从 html 中提取图像 任何指示 建议都会有很大帮助 profile path
  • 如何在创建广告帐户 Facebook 营销 api 时为 aduser 提供管理员访问权限

    我正在尝试使用以下代码通过 Facebook 营销和图形 API 在 Facebook 业务管理器中创建广告帐户 attachment array access token gt this gt accessToken name gt as
  • Seaborn 子图上的 GridSpec

    我目前有 2 个使用 seaborn 的子图 import matplotlib pyplot as plt import seaborn apionly as sns f ax1 ax2 plt subplots 2 sharex Tru
  • 使用 Visual AutoLayout 在 NSScrollView 中布局多个视图

    我需要显示内部垂直对齐的多个视图NSScrollView 我首先添加NSTableView and NSButton 我将它们垂直对齐NSTableView在顶部和NSButton在底部 我添加了NSTableview and NSButt
  • 使用以西班牙语显示日期名称的日期时间值设置 x 轴格式

    我有一系列关于天气的数据 在这种情况下 只有 14 天的温度 Plotly 可以很好地自动管理日期 但我无法更改日期的语言并设置 python 区域设置locale setlocale locale LC TIME es ES 不影响 Pl
  • 两个日期计算字段之间的值的 SQL SUM

    我有这个查询 它返回 null SELECT SUM sales as MAT from TABLE2 where Date1 between CONVERT VARCHAR 23 DATEADD MONTH 11 Date1 111 an
  • 比较本地文件与远程文件

    我有以下问题 我有一个本地 zip文件和一个 zip文件位于服务器上 我需要检查是否 zip服务器上的文件与本地的不一样 如果不是 我需要从服务器中提取新的 我的问题是如何在不从服务器下载文件并在本地比较它们的情况下比较它们 我可以在创建时
  • py2app 中的错误

    我正在一个简单的 test py 应用程序上测试 py2app 没有做任何特别的事情 python 3 6 py2app 0 14 当我发出以下命令时 它构建得很好 没有错误 python3 6 setup py py2app A 但当我启
  • 如何在列表框中实现保持?

    如果按住列表框 我想获取列表框索引 这是我的代码
  • 通过手动链接打开多个 Fancybox 画廊

    我尝试转换中提供的解决方案如何通过手动调用 html 中的画廊而不是通过 jquery 选项来打开 fancybox 为了将其应用到多个画廊 但无法使其正常运行 我拥有的是几个具有以下属性的链接 a href class open albu
  • 如何在react-native中使用FormData?

    你好 刚学会使用 js 和 React Native 我无法使用 FormData 它总是显示不受支持的 bodyinit 类型 我想发送文本而不是 JSON stringify 谁能帮我 谢谢 var data new FormData
  • 有没有办法放大 D3 力布局图?

    D3 具有力导向布局here 有没有办法给这个图添加缩放功能 目前 我能够捕获鼠标滚轮事件 但不太确定如何编写重绘函数本身 有什么建议么 var vis d3 select graph append svg svg call d3 beha
  • Java GridBagLayout自动化构建

    我使用 GridBagLayout 和 GridBagConstraints 设计了一个 GUI 它包含可变数量的行 每行都有几种可能的列布局之一 为了测试代码 我使用了不同颜色的面板 GUI 来说明每行和每列中所有单元格的位置和调整大小行